diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/.openapi-generator/FILES b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/.openapi-generator/FILES index be34867f3..53afc312e 100644 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/.openapi-generator/FILES +++ b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/.openapi-generator/FILES @@ -1,7 +1,6 @@ Cargo.toml README.md docs/Application.md -docs/ApplicationFilter.md docs/Assignment.md docs/AuthenticodeSignatureStatus.md docs/Certificate.md @@ -16,24 +15,17 @@ docs/Error.md docs/ErrorResponse.md docs/GetProfilesMeResponse.md docs/Hash.md -docs/HashFilter.md docs/LaunchPayload.md docs/LaunchResponse.md docs/OptionalId.md -docs/PathFilter.md -docs/PathFilterKind.md docs/PathIdParameter.md docs/Profile.md -docs/Rule.md docs/SessionElevationConfiguration.md docs/SessionElevationStatus.md docs/Signature.md -docs/SignatureFilter.md docs/Signer.md docs/StartupInfoDto.md docs/StatusResponse.md -docs/StringFilter.md -docs/StringFilterKind.md docs/TemporaryElevationConfiguration.md docs/TemporaryElevationStatus.md docs/User.md @@ -44,7 +36,6 @@ src/apis/mod.rs src/apis/request.rs src/lib.rs src/models/application.rs -src/models/application_filter.rs src/models/assignment.rs src/models/authenticode_signature_status.rs src/models/certificate.rs @@ -58,25 +49,18 @@ src/models/error.rs src/models/error_response.rs src/models/get_profiles_me_response.rs src/models/hash.rs -src/models/hash_filter.rs src/models/launch_payload.rs src/models/launch_response.rs src/models/mod.rs src/models/optional_id.rs -src/models/path_filter.rs -src/models/path_filter_kind.rs src/models/path_id_parameter.rs src/models/profile.rs -src/models/rule.rs src/models/session_elevation_configuration.rs src/models/session_elevation_status.rs src/models/signature.rs -src/models/signature_filter.rs src/models/signer.rs src/models/startup_info_dto.rs src/models/status_response.rs -src/models/string_filter.rs -src/models/string_filter_kind.rs src/models/temporary_elevation_configuration.rs src/models/temporary_elevation_status.rs src/models/user.rs diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/README.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/README.md index 89cd21f93..477848c6b 100644 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/README.md +++ b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/README.md @@ -39,11 +39,6 @@ Class | Method | HTTP request | Description *DefaultApi* | [**policy_profiles_id_get**](docs/DefaultApi.md#policy_profiles_id_get) | **Get** /policy/profiles/{id} | *DefaultApi* | [**policy_profiles_id_put**](docs/DefaultApi.md#policy_profiles_id_put) | **Put** /policy/profiles/{id} | *DefaultApi* | [**policy_profiles_post**](docs/DefaultApi.md#policy_profiles_post) | **Post** /policy/profiles | -*DefaultApi* | [**policy_rules_get**](docs/DefaultApi.md#policy_rules_get) | **Get** /policy/rules | -*DefaultApi* | [**policy_rules_id_delete**](docs/DefaultApi.md#policy_rules_id_delete) | **Delete** /policy/rules/{id} | -*DefaultApi* | [**policy_rules_id_get**](docs/DefaultApi.md#policy_rules_id_get) | **Get** /policy/rules/{id} | -*DefaultApi* | [**policy_rules_id_put**](docs/DefaultApi.md#policy_rules_id_put) | **Put** /policy/rules/{id} | -*DefaultApi* | [**policy_rules_post**](docs/DefaultApi.md#policy_rules_post) | **Post** /policy/rules | *DefaultApi* | [**revoke_post**](docs/DefaultApi.md#revoke_post) | **Post** /revoke | *DefaultApi* | [**status_get**](docs/DefaultApi.md#status_get) | **Get** /status | @@ -51,7 +46,6 @@ Class | Method | HTTP request | Description ## Documentation For Models - [Application](docs/Application.md) - - [ApplicationFilter](docs/ApplicationFilter.md) - [Assignment](docs/Assignment.md) - [AuthenticodeSignatureStatus](docs/AuthenticodeSignatureStatus.md) - [Certificate](docs/Certificate.md) @@ -65,24 +59,17 @@ Class | Method | HTTP request | Description - [ErrorResponse](docs/ErrorResponse.md) - [GetProfilesMeResponse](docs/GetProfilesMeResponse.md) - [Hash](docs/Hash.md) - - [HashFilter](docs/HashFilter.md) - [LaunchPayload](docs/LaunchPayload.md) - [LaunchResponse](docs/LaunchResponse.md) - [OptionalId](docs/OptionalId.md) - - [PathFilter](docs/PathFilter.md) - - [PathFilterKind](docs/PathFilterKind.md) - [PathIdParameter](docs/PathIdParameter.md) - [Profile](docs/Profile.md) - - [Rule](docs/Rule.md) - [SessionElevationConfiguration](docs/SessionElevationConfiguration.md) - [SessionElevationStatus](docs/SessionElevationStatus.md) - [Signature](docs/Signature.md) - - [SignatureFilter](docs/SignatureFilter.md) - [Signer](docs/Signer.md) - [StartupInfoDto](docs/StartupInfoDto.md) - [StatusResponse](docs/StatusResponse.md) - - [StringFilter](docs/StringFilter.md) - - [StringFilterKind](docs/StringFilterKind.md) - [TemporaryElevationConfiguration](docs/TemporaryElevationConfiguration.md) - [TemporaryElevationStatus](docs/TemporaryElevationStatus.md) - [User](docs/User.md) diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/ApplicationFilter.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/ApplicationFilter.md deleted file mode 100644 index 72c8019e5..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/ApplicationFilter.md +++ /dev/null @@ -1,15 +0,0 @@ -# ApplicationFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**command_line** | Option<[**Vec**](StringFilter.md)> | | [optional] -**hashes** | Option<[**Vec**](HashFilter.md)> | | [optional] -**path** | [**models::PathFilter**](PathFilter.md) | | -**signature** | Option<[**models::SignatureFilter**](SignatureFilter.md)> | | [optional] -**working_directory** | Option<[**models::PathFilter**](PathFilter.md)> | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/DefaultApi.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/DefaultApi.md index e8cf0d283..e4cfe56e8 100644 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/DefaultApi.md +++ b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/DefaultApi.md @@ -17,11 +17,6 @@ Method | HTTP request | Description [**policy_profiles_id_get**](DefaultApi.md#policy_profiles_id_get) | **Get** /policy/profiles/{id} | [**policy_profiles_id_put**](DefaultApi.md#policy_profiles_id_put) | **Put** /policy/profiles/{id} | [**policy_profiles_post**](DefaultApi.md#policy_profiles_post) | **Post** /policy/profiles | -[**policy_rules_get**](DefaultApi.md#policy_rules_get) | **Get** /policy/rules | -[**policy_rules_id_delete**](DefaultApi.md#policy_rules_id_delete) | **Delete** /policy/rules/{id} | -[**policy_rules_id_get**](DefaultApi.md#policy_rules_id_get) | **Get** /policy/rules/{id} | -[**policy_rules_id_put**](DefaultApi.md#policy_rules_id_put) | **Put** /policy/rules/{id} | -[**policy_rules_post**](DefaultApi.md#policy_rules_post) | **Post** /policy/rules | [**revoke_post**](DefaultApi.md#revoke_post) | **Post** /revoke | [**status_get**](DefaultApi.md#status_get) | **Get** /status | @@ -378,144 +373,6 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## policy_rules_get - -> Vec policy_rules_get() - - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -**Vec** - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## policy_rules_id_delete - -> policy_rules_id_delete(id) - - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**id** | **String** | | [required] | - -### Return type - - (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## policy_rules_id_get - -> models::Rule policy_rules_id_get(id) - - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**id** | **String** | | [required] | - -### Return type - -[**models::Rule**](Rule.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## policy_rules_id_put - -> policy_rules_id_put(id, rule) - - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**id** | **String** | | [required] | -**rule** | [**Rule**](Rule.md) | | [required] | - -### Return type - - (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## policy_rules_post - -> policy_rules_post(rule) - - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**rule** | [**Rule**](Rule.md) | | [required] | - -### Return type - - (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - ## revoke_post > revoke_post() diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/HashFilter.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/HashFilter.md deleted file mode 100644 index fed63075c..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/HashFilter.md +++ /dev/null @@ -1,12 +0,0 @@ -# HashFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**sha1** | Option<**String**> | | [optional] -**sha256** | Option<**String**> | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/PathFilter.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/PathFilter.md deleted file mode 100644 index a70f03e9b..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/PathFilter.md +++ /dev/null @@ -1,12 +0,0 @@ -# PathFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | **String** | | -**kind** | [**models::PathFilterKind**](PathFilterKind.md) | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/PathFilterKind.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/PathFilterKind.md deleted file mode 100644 index a312be781..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/PathFilterKind.md +++ /dev/null @@ -1,14 +0,0 @@ -# PathFilterKind - -## Enum Variants - -| Name | Value | -|---- | -----| -| Equals | Equals | -| FileName | FileName | -| Wildcard | Wildcard | - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Profile.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Profile.md index 5b75f3708..8087b0f4d 100644 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Profile.md +++ b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Profile.md @@ -10,7 +10,6 @@ Name | Type | Description | Notes **id** | Option<**String**> | | [optional] **name** | Option<**String**> | | [optional][default to Unnamed profile] **prompt_secure_desktop** | Option<**bool**> | | [optional][default to true] -**rules** | Option<**Vec**> | | [optional][default to []] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Rule.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Rule.md deleted file mode 100644 index 03c6a91d6..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Rule.md +++ /dev/null @@ -1,15 +0,0 @@ -# Rule - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**asker** | Option<[**models::ApplicationFilter**](ApplicationFilter.md)> | | [optional] -**elevation_kind** | [**models::ElevationKind**](ElevationKind.md) | | -**id** | **String** | | -**name** | **String** | | -**target** | [**models::ApplicationFilter**](ApplicationFilter.md) | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/SignatureFilter.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/SignatureFilter.md deleted file mode 100644 index c318e292f..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/SignatureFilter.md +++ /dev/null @@ -1,11 +0,0 @@ -# SignatureFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**check_authenticode** | **bool** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/StringFilter.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/StringFilter.md deleted file mode 100644 index 3a82ce43d..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/StringFilter.md +++ /dev/null @@ -1,12 +0,0 @@ -# StringFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | **String** | | -**kind** | [**models::StringFilterKind**](StringFilterKind.md) | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/StringFilterKind.md b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/StringFilterKind.md deleted file mode 100644 index d872540b5..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/StringFilterKind.md +++ /dev/null @@ -1,16 +0,0 @@ -# StringFilterKind - -## Enum Variants - -| Name | Value | -|---- | -----| -| Equals | Equals | -| Regex | Regex | -| StartsWith | StartsWith | -| EndsWith | EndsWith | -| Contains | Contains | - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/default_api.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/default_api.rs index 98721bc73..0c96f0c4d 100644 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/default_api.rs +++ b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/default_api.rs @@ -17,7 +17,8 @@ use std::rc::Rc; use futures::Future; use hyper; -use super::{configuration, request as __internal_request, Error}; +use super::request as __internal_request; +use super::{configuration, Error}; use crate::models; pub struct DefaultApiClient @@ -64,11 +65,6 @@ pub trait DefaultApi { profile: models::Profile, ) -> Pin>>>; fn policy_profiles_post(&self, profile: models::Profile) -> Pin>>>; - fn policy_rules_get(&self) -> Pin, Error>>>>; - fn policy_rules_id_delete(&self, id: &str) -> Pin>>>; - fn policy_rules_id_get(&self, id: &str) -> Pin>>>; - fn policy_rules_id_put(&self, id: &str, rule: models::Rule) -> Pin>>>; - fn policy_rules_post(&self, rule: models::Rule) -> Pin>>>; fn revoke_post(&self) -> Pin>>>; fn status_get(&self) -> Pin>>>; } @@ -199,49 +195,6 @@ where req.execute(self.configuration.borrow()) } - #[allow(unused_mut)] - fn policy_rules_get(&self) -> Pin, Error>>>> { - let mut req = __internal_request::Request::new(hyper::Method::GET, "/policy/rules".to_string()); - - req.execute(self.configuration.borrow()) - } - - #[allow(unused_mut)] - fn policy_rules_id_delete(&self, id: &str) -> Pin>>> { - let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/policy/rules/{id}".to_string()); - req = req.with_path_param("id".to_string(), id.to_string()); - req = req.returns_nothing(); - - req.execute(self.configuration.borrow()) - } - - #[allow(unused_mut)] - fn policy_rules_id_get(&self, id: &str) -> Pin>>> { - let mut req = __internal_request::Request::new(hyper::Method::GET, "/policy/rules/{id}".to_string()); - req = req.with_path_param("id".to_string(), id.to_string()); - - req.execute(self.configuration.borrow()) - } - - #[allow(unused_mut)] - fn policy_rules_id_put(&self, id: &str, rule: models::Rule) -> Pin>>> { - let mut req = __internal_request::Request::new(hyper::Method::PUT, "/policy/rules/{id}".to_string()); - req = req.with_path_param("id".to_string(), id.to_string()); - req = req.with_body_param(rule); - req = req.returns_nothing(); - - req.execute(self.configuration.borrow()) - } - - #[allow(unused_mut)] - fn policy_rules_post(&self, rule: models::Rule) -> Pin>>> { - let mut req = __internal_request::Request::new(hyper::Method::POST, "/policy/rules".to_string()); - req = req.with_body_param(rule); - req = req.returns_nothing(); - - req.execute(self.configuration.borrow()) - } - #[allow(unused_mut)] fn revoke_post(&self) -> Pin>>> { let mut req = __internal_request::Request::new(hyper::Method::POST, "/revoke".to_string()); diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/mod.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/mod.rs index e907d7d10..e3cddab41 100644 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/mod.rs +++ b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/mod.rs @@ -1,4 +1,6 @@ -use {http, hyper, serde_json}; +use http; +use hyper; +use serde_json; #[derive(Debug)] pub enum Error { diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/request.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/request.rs index 44d52c91b..b511abd40 100644 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/request.rs +++ b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/apis/request.rs @@ -1,10 +1,13 @@ use std::collections::HashMap; use std::pin::Pin; +use futures; use futures::future::*; use futures::Future; +use hyper; use hyper::header::{HeaderValue, AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, USER_AGENT}; -use {futures, hyper, serde, serde_json}; +use serde; +use serde_json; use super::{configuration, Error}; diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/application_filter.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/application_filter.rs deleted file mode 100644 index e74535a50..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/application_filter.rs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: - * - * Generated by: https://openapi-generator.tech - */ - -use crate::models; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ApplicationFilter { - #[serde(rename = "CommandLine", skip_serializing_if = "Option::is_none")] - pub command_line: Option>, - #[serde(rename = "Hashes", skip_serializing_if = "Option::is_none")] - pub hashes: Option>, - #[serde(rename = "Path")] - pub path: models::PathFilter, - #[serde(rename = "Signature", skip_serializing_if = "Option::is_none")] - pub signature: Option, - #[serde(rename = "WorkingDirectory", skip_serializing_if = "Option::is_none")] - pub working_directory: Option, -} - -impl ApplicationFilter { - pub fn new(path: models::PathFilter) -> ApplicationFilter { - ApplicationFilter { - command_line: None, - hashes: None, - path, - signature: None, - working_directory: None, - } - } -} diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/hash_filter.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/hash_filter.rs deleted file mode 100644 index b6d27ed9c..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/hash_filter.rs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: - * - * Generated by: https://openapi-generator.tech - */ - -use crate::models; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct HashFilter { - #[serde(rename = "Sha1", skip_serializing_if = "Option::is_none")] - pub sha1: Option, - #[serde(rename = "Sha256", skip_serializing_if = "Option::is_none")] - pub sha256: Option, -} - -impl HashFilter { - pub fn new() -> HashFilter { - HashFilter { - sha1: None, - sha256: None, - } - } -} diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/mod.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/mod.rs index 7d7f1f1c7..289a752a2 100644 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/mod.rs +++ b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/mod.rs @@ -1,7 +1,5 @@ pub mod application; pub use self::application::Application; -pub mod application_filter; -pub use self::application_filter::ApplicationFilter; pub mod assignment; pub use self::assignment::Assignment; pub mod authenticode_signature_status; @@ -28,42 +26,28 @@ pub mod get_profiles_me_response; pub use self::get_profiles_me_response::GetProfilesMeResponse; pub mod hash; pub use self::hash::Hash; -pub mod hash_filter; -pub use self::hash_filter::HashFilter; pub mod launch_payload; pub use self::launch_payload::LaunchPayload; pub mod launch_response; pub use self::launch_response::LaunchResponse; pub mod optional_id; pub use self::optional_id::OptionalId; -pub mod path_filter; -pub use self::path_filter::PathFilter; -pub mod path_filter_kind; -pub use self::path_filter_kind::PathFilterKind; pub mod path_id_parameter; pub use self::path_id_parameter::PathIdParameter; pub mod profile; pub use self::profile::Profile; -pub mod rule; -pub use self::rule::Rule; pub mod session_elevation_configuration; pub use self::session_elevation_configuration::SessionElevationConfiguration; pub mod session_elevation_status; pub use self::session_elevation_status::SessionElevationStatus; pub mod signature; pub use self::signature::Signature; -pub mod signature_filter; -pub use self::signature_filter::SignatureFilter; pub mod signer; pub use self::signer::Signer; pub mod startup_info_dto; pub use self::startup_info_dto::StartupInfoDto; pub mod status_response; pub use self::status_response::StatusResponse; -pub mod string_filter; -pub use self::string_filter::StringFilter; -pub mod string_filter_kind; -pub use self::string_filter_kind::StringFilterKind; pub mod temporary_elevation_configuration; pub use self::temporary_elevation_configuration::TemporaryElevationConfiguration; pub mod temporary_elevation_status; diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/path_filter.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/path_filter.rs deleted file mode 100644 index 5951cab9d..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/path_filter.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: - * - * Generated by: https://openapi-generator.tech - */ - -use crate::models; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PathFilter { - #[serde(rename = "Data")] - pub data: String, - #[serde(rename = "Kind")] - pub kind: models::PathFilterKind, -} - -impl PathFilter { - pub fn new(data: String, kind: models::PathFilterKind) -> PathFilter { - PathFilter { data, kind } - } -} diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/path_filter_kind.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/path_filter_kind.rs deleted file mode 100644 index 637c0bfc0..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/path_filter_kind.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: - * - * Generated by: https://openapi-generator.tech - */ - -use crate::models; -use serde::{Deserialize, Serialize}; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum PathFilterKind { - #[serde(rename = "Equals")] - Equals, - #[serde(rename = "FileName")] - FileName, - #[serde(rename = "Wildcard")] - Wildcard, -} - -impl std::fmt::Display for PathFilterKind { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Equals => write!(f, "Equals"), - Self::FileName => write!(f, "FileName"), - Self::Wildcard => write!(f, "Wildcard"), - } - } -} - -impl Default for PathFilterKind { - fn default() -> PathFilterKind { - Self::Equals - } -} diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/profile.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/profile.rs index 7b30e75d3..d925f8f99 100644 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/profile.rs +++ b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/profile.rs @@ -25,8 +25,6 @@ pub struct Profile { pub name: Option, #[serde(rename = "PromptSecureDesktop", skip_serializing_if = "Option::is_none")] pub prompt_secure_desktop: Option, - #[serde(rename = "Rules", skip_serializing_if = "Option::is_none")] - pub rules: Option>, } impl Profile { @@ -38,7 +36,6 @@ impl Profile { id: None, name: None, prompt_secure_desktop: None, - rules: None, } } } diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/rule.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/rule.rs deleted file mode 100644 index b98beae7c..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/rule.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: - * - * Generated by: https://openapi-generator.tech - */ - -use crate::models; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct Rule { - #[serde(rename = "Asker", skip_serializing_if = "Option::is_none")] - pub asker: Option, - #[serde(rename = "ElevationKind")] - pub elevation_kind: models::ElevationKind, - #[serde(rename = "Id")] - pub id: String, - #[serde(rename = "Name")] - pub name: String, - #[serde(rename = "Target")] - pub target: models::ApplicationFilter, -} - -impl Rule { - pub fn new( - elevation_kind: models::ElevationKind, - id: String, - name: String, - target: models::ApplicationFilter, - ) -> Rule { - Rule { - asker: None, - elevation_kind, - id, - name, - target, - } - } -} diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/signature_filter.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/signature_filter.rs deleted file mode 100644 index cec8384d6..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/signature_filter.rs +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: - * - * Generated by: https://openapi-generator.tech - */ - -use crate::models; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SignatureFilter { - #[serde(rename = "CheckAuthenticode")] - pub check_authenticode: bool, -} - -impl SignatureFilter { - pub fn new(check_authenticode: bool) -> SignatureFilter { - SignatureFilter { check_authenticode } - } -} diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/string_filter.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/string_filter.rs deleted file mode 100644 index 0f5958e19..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/string_filter.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: - * - * Generated by: https://openapi-generator.tech - */ - -use crate::models; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct StringFilter { - #[serde(rename = "Data")] - pub data: String, - #[serde(rename = "Kind")] - pub kind: models::StringFilterKind, -} - -impl StringFilter { - pub fn new(data: String, kind: models::StringFilterKind) -> StringFilter { - StringFilter { data, kind } - } -} diff --git a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/string_filter_kind.rs b/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/string_filter_kind.rs deleted file mode 100644 index 8bdb76af6..000000000 --- a/crates/devolutions-pedm-shared/devolutions-pedm-client-http/src/models/string_filter_kind.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: - * - * Generated by: https://openapi-generator.tech - */ - -use crate::models; -use serde::{Deserialize, Serialize}; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum StringFilterKind { - #[serde(rename = "Equals")] - Equals, - #[serde(rename = "Regex")] - Regex, - #[serde(rename = "StartsWith")] - StartsWith, - #[serde(rename = "EndsWith")] - EndsWith, - #[serde(rename = "Contains")] - Contains, -} - -impl std::fmt::Display for StringFilterKind { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Equals => write!(f, "Equals"), - Self::Regex => write!(f, "Regex"), - Self::StartsWith => write!(f, "StartsWith"), - Self::EndsWith => write!(f, "EndsWith"), - Self::Contains => write!(f, "Contains"), - } - } -} - -impl Default for StringFilterKind { - fn default() -> StringFilterKind { - Self::Equals - } -} diff --git a/crates/devolutions-pedm-shared/src/desktop.rs b/crates/devolutions-pedm-shared/src/desktop.rs index 690a23b03..5225a50c9 100644 --- a/crates/devolutions-pedm-shared/src/desktop.rs +++ b/crates/devolutions-pedm-shared/src/desktop.rs @@ -7,6 +7,7 @@ use win_api_wrappers::raw::Win32::Security::TOKEN_QUERY; use windows_registry::LOCAL_MACHINE; pub fn install_dir() -> Result { + // TODO: lookup from registry only works when installed by MSI Ok(PathBuf::from_str( &LOCAL_MACHINE .open(r"SOFTWARE\Devolutions\Agent")? @@ -17,7 +18,8 @@ pub fn install_dir() -> Result { pub fn desktop_exe() -> Result { let mut exe = install_dir()?; - exe.push("desktop/DevolutionsPedmDesktop.exe"); + exe.push("desktop"); + exe.push("DevolutionsDesktopAgent.exe"); Ok(exe) } @@ -28,6 +30,7 @@ pub enum DesktopMode { pub fn launch(mode: &DesktopMode) -> Result<()> { let mut base_command = Command::new(desktop_exe()?); + base_command.arg(desktop_exe()?); base_command.arg( Process::current_process() .token(TOKEN_QUERY)? diff --git a/crates/devolutions-pedm-shared/src/policy.rs b/crates/devolutions-pedm-shared/src/policy.rs index 5f3c8d8a0..f1b99e25f 100644 --- a/crates/devolutions-pedm-shared/src/policy.rs +++ b/crates/devolutions-pedm-shared/src/policy.rs @@ -271,22 +271,6 @@ impl ElevationRequest { } } -#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone)] -#[serde(rename_all = "PascalCase")] -pub struct Rule { - pub id: Id, - pub name: String, - pub target: ApplicationFilter, - pub asker: Option, - pub elevation_kind: ElevationKind, -} - -impl Identifiable for Rule { - fn id(&self) -> &Id { - &self.id - } -} - #[derive(Serialize, Deserialize, JsonSchema, Debug)] #[repr(i32)] #[serde(rename_all = "PascalCase")] @@ -365,7 +349,6 @@ pub struct Profile { pub elevation_settings: ElevationConfigurations, pub default_elevation_kind: ElevationKind, pub prompt_secure_desktop: bool, - pub rules: Vec, } impl Identifiable for Profile { @@ -383,7 +366,6 @@ impl Default for Profile { elevation_settings: ElevationConfigurations::default(), default_elevation_kind: ElevationKind::Deny, prompt_secure_desktop: true, - rules: vec![], } } } diff --git a/crates/devolutions-pedm/DevolutionsPedmDesktop/FrmConsent.cs b/crates/devolutions-pedm/DevolutionsPedmDesktop/FrmConsent.cs index f5de65e35..414f640a8 100644 --- a/crates/devolutions-pedm/DevolutionsPedmDesktop/FrmConsent.cs +++ b/crates/devolutions-pedm/DevolutionsPedmDesktop/FrmConsent.cs @@ -10,7 +10,7 @@ public FrmConsent(PipeStream pipe, string path) { InitializeComponent(); - appView.ExePath = path; + appView.ExePath = path.TrimStart(new char[] {'\\', '?'}); _pipe = pipe; } diff --git a/crates/devolutions-pedm/openapi/dotnet-client/.openapi-generator/FILES b/crates/devolutions-pedm/openapi/dotnet-client/.openapi-generator/FILES index 0646d56ca..2e91226d4 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/.openapi-generator/FILES +++ b/crates/devolutions-pedm/openapi/dotnet-client/.openapi-generator/FILES @@ -3,7 +3,6 @@ Devolutions.Pedm.Client.sln README.md api/openapi.yaml docs/Application.md -docs/ApplicationFilter.md docs/Assignment.md docs/AuthenticodeSignatureStatus.md docs/Certificate.md @@ -18,24 +17,17 @@ docs/Error.md docs/ErrorResponse.md docs/GetProfilesMeResponse.md docs/Hash.md -docs/HashFilter.md docs/LaunchPayload.md docs/LaunchResponse.md docs/OptionalId.md -docs/PathFilter.md -docs/PathFilterKind.md docs/PathIdParameter.md docs/Profile.md -docs/Rule.md docs/SessionElevationConfiguration.md docs/SessionElevationStatus.md docs/Signature.md -docs/SignatureFilter.md docs/Signer.md docs/StartupInfoDto.md docs/StatusResponse.md -docs/StringFilter.md -docs/StringFilterKind.md docs/TemporaryElevationConfiguration.md docs/TemporaryElevationStatus.md docs/User.md @@ -60,7 +52,6 @@ src/Devolutions.Pedm.Client/Client/WebRequestPathBuilder.cs src/Devolutions.Pedm.Client/Devolutions.Pedm.Client.csproj src/Devolutions.Pedm.Client/Model/AbstractOpenAPISchema.cs src/Devolutions.Pedm.Client/Model/Application.cs -src/Devolutions.Pedm.Client/Model/ApplicationFilter.cs src/Devolutions.Pedm.Client/Model/Assignment.cs src/Devolutions.Pedm.Client/Model/AuthenticodeSignatureStatus.cs src/Devolutions.Pedm.Client/Model/Certificate.cs @@ -74,24 +65,17 @@ src/Devolutions.Pedm.Client/Model/Error.cs src/Devolutions.Pedm.Client/Model/ErrorResponse.cs src/Devolutions.Pedm.Client/Model/GetProfilesMeResponse.cs src/Devolutions.Pedm.Client/Model/Hash.cs -src/Devolutions.Pedm.Client/Model/HashFilter.cs src/Devolutions.Pedm.Client/Model/LaunchPayload.cs src/Devolutions.Pedm.Client/Model/LaunchResponse.cs src/Devolutions.Pedm.Client/Model/OptionalId.cs -src/Devolutions.Pedm.Client/Model/PathFilter.cs -src/Devolutions.Pedm.Client/Model/PathFilterKind.cs src/Devolutions.Pedm.Client/Model/PathIdParameter.cs src/Devolutions.Pedm.Client/Model/Profile.cs -src/Devolutions.Pedm.Client/Model/Rule.cs src/Devolutions.Pedm.Client/Model/SessionElevationConfiguration.cs src/Devolutions.Pedm.Client/Model/SessionElevationStatus.cs src/Devolutions.Pedm.Client/Model/Signature.cs -src/Devolutions.Pedm.Client/Model/SignatureFilter.cs src/Devolutions.Pedm.Client/Model/Signer.cs src/Devolutions.Pedm.Client/Model/StartupInfoDto.cs src/Devolutions.Pedm.Client/Model/StatusResponse.cs -src/Devolutions.Pedm.Client/Model/StringFilter.cs -src/Devolutions.Pedm.Client/Model/StringFilterKind.cs src/Devolutions.Pedm.Client/Model/TemporaryElevationConfiguration.cs src/Devolutions.Pedm.Client/Model/TemporaryElevationStatus.cs src/Devolutions.Pedm.Client/Model/User.cs diff --git a/crates/devolutions-pedm/openapi/dotnet-client/README.md b/crates/devolutions-pedm/openapi/dotnet-client/README.md index 6240a4365..93ce551d8 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/README.md +++ b/crates/devolutions-pedm/openapi/dotnet-client/README.md @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/opena This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: -- SDK version: 2024.8.13 +- SDK version: 2024.10.25 - Generator version: 7.7.0 - Build package: org.openapitools.codegen.languages.CSharpClientCodegen @@ -149,11 +149,6 @@ Class | Method | HTTP request | Description *DefaultApi* | [**PolicyProfilesIdGet**](docs/DefaultApi.md#policyprofilesidget) | **GET** /policy/profiles/{id} | *DefaultApi* | [**PolicyProfilesIdPut**](docs/DefaultApi.md#policyprofilesidput) | **PUT** /policy/profiles/{id} | *DefaultApi* | [**PolicyProfilesPost**](docs/DefaultApi.md#policyprofilespost) | **POST** /policy/profiles | -*DefaultApi* | [**PolicyRulesGet**](docs/DefaultApi.md#policyrulesget) | **GET** /policy/rules | -*DefaultApi* | [**PolicyRulesIdDelete**](docs/DefaultApi.md#policyrulesiddelete) | **DELETE** /policy/rules/{id} | -*DefaultApi* | [**PolicyRulesIdGet**](docs/DefaultApi.md#policyrulesidget) | **GET** /policy/rules/{id} | -*DefaultApi* | [**PolicyRulesIdPut**](docs/DefaultApi.md#policyrulesidput) | **PUT** /policy/rules/{id} | -*DefaultApi* | [**PolicyRulesPost**](docs/DefaultApi.md#policyrulespost) | **POST** /policy/rules | *DefaultApi* | [**RevokePost**](docs/DefaultApi.md#revokepost) | **POST** /revoke | *DefaultApi* | [**StatusGet**](docs/DefaultApi.md#statusget) | **GET** /status | @@ -162,7 +157,6 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Model.Application](docs/Application.md) - - [Model.ApplicationFilter](docs/ApplicationFilter.md) - [Model.Assignment](docs/Assignment.md) - [Model.AuthenticodeSignatureStatus](docs/AuthenticodeSignatureStatus.md) - [Model.Certificate](docs/Certificate.md) @@ -176,24 +170,17 @@ Class | Method | HTTP request | Description - [Model.ErrorResponse](docs/ErrorResponse.md) - [Model.GetProfilesMeResponse](docs/GetProfilesMeResponse.md) - [Model.Hash](docs/Hash.md) - - [Model.HashFilter](docs/HashFilter.md) - [Model.LaunchPayload](docs/LaunchPayload.md) - [Model.LaunchResponse](docs/LaunchResponse.md) - [Model.OptionalId](docs/OptionalId.md) - - [Model.PathFilter](docs/PathFilter.md) - - [Model.PathFilterKind](docs/PathFilterKind.md) - [Model.PathIdParameter](docs/PathIdParameter.md) - [Model.Profile](docs/Profile.md) - - [Model.Rule](docs/Rule.md) - [Model.SessionElevationConfiguration](docs/SessionElevationConfiguration.md) - [Model.SessionElevationStatus](docs/SessionElevationStatus.md) - [Model.Signature](docs/Signature.md) - - [Model.SignatureFilter](docs/SignatureFilter.md) - [Model.Signer](docs/Signer.md) - [Model.StartupInfoDto](docs/StartupInfoDto.md) - [Model.StatusResponse](docs/StatusResponse.md) - - [Model.StringFilter](docs/StringFilter.md) - - [Model.StringFilterKind](docs/StringFilterKind.md) - [Model.TemporaryElevationConfiguration](docs/TemporaryElevationConfiguration.md) - [Model.TemporaryElevationStatus](docs/TemporaryElevationStatus.md) - [Model.User](docs/User.md) diff --git a/crates/devolutions-pedm/openapi/dotnet-client/api/openapi.yaml b/crates/devolutions-pedm/openapi/dotnet-client/api/openapi.yaml index c08ddfe70..9dbf176fa 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/api/openapi.yaml +++ b/crates/devolutions-pedm/openapi/dotnet-client/api/openapi.yaml @@ -226,104 +226,6 @@ paths: description: "" "200": description: no content - /policy/rules: - get: - responses: - default: - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - description: "" - "200": - content: - application/json: - schema: - items: - $ref: '#/components/schemas/Id' - type: array - description: "" - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Rule' - required: true - responses: - default: - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - description: "" - "200": - description: no content - /policy/rules/{id}: - delete: - parameters: - - explode: false - in: path - name: id - required: true - schema: - $ref: '#/components/schemas/Id' - style: simple - responses: - default: - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - description: "" - "200": - description: no content - get: - parameters: - - explode: false - in: path - name: id - required: true - schema: - $ref: '#/components/schemas/Id' - style: simple - responses: - default: - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - description: "" - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/Rule' - description: "" - put: - parameters: - - explode: false - in: path - name: id - required: true - schema: - $ref: '#/components/schemas/Id' - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Rule' - required: true - responses: - default: - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - description: "" - "200": - description: no content /policy/assignments: get: responses: @@ -432,45 +334,6 @@ components: - Signature - User - WorkingDirectory - ApplicationFilter: - example: - Path: - Kind: Equals - Data: Data - WorkingDirectory: - Kind: Equals - Data: Data - CommandLine: - - Kind: Equals - Data: Data - - Kind: Equals - Data: Data - Hashes: - - Sha1: Sha1 - Sha256: Sha256 - - Sha1: Sha1 - Sha256: Sha256 - Signature: - CheckAuthenticode: true - properties: - CommandLine: - items: - $ref: '#/components/schemas/StringFilter' - type: array - nullable: true - Hashes: - items: - $ref: '#/components/schemas/HashFilter' - type: array - nullable: true - Path: - $ref: '#/components/schemas/PathFilter' - Signature: - $ref: '#/components/schemas/SignatureFilter' - WorkingDirectory: - $ref: '#/components/schemas/PathFilter' - required: - - Path Assignment: example: Users: @@ -493,9 +356,6 @@ components: Session: Enabled: true ElevationMethod: LocalAdmin - Rules: - - null - - null Name: Unnamed profile properties: Profile: @@ -821,17 +681,6 @@ components: required: - Sha1 - Sha256 - HashFilter: - example: - Sha1: Sha1 - Sha256: Sha256 - properties: - Sha1: - type: string - nullable: true - Sha256: - type: string - nullable: true Id: type: string LaunchPayload: @@ -893,24 +742,6 @@ components: properties: Id: type: string - PathFilter: - example: - Kind: Equals - Data: Data - properties: - Data: - type: string - Kind: - $ref: '#/components/schemas/PathFilterKind' - required: - - Data - - Kind - PathFilterKind: - enum: - - Equals - - FileName - - Wildcard - type: string PathIdParameter: properties: id: @@ -929,9 +760,6 @@ components: Session: Enabled: true ElevationMethod: LocalAdmin - Rules: - - null - - null Name: Unnamed profile properties: DefaultElevationKind: @@ -948,70 +776,6 @@ components: PromptSecureDesktop: default: true type: boolean - Rules: - default: [] - items: - $ref: '#/components/schemas/Id' - type: array - Rule: - example: - Target: - Path: - Kind: Equals - Data: Data - WorkingDirectory: - Kind: Equals - Data: Data - CommandLine: - - Kind: Equals - Data: Data - - Kind: Equals - Data: Data - Hashes: - - Sha1: Sha1 - Sha256: Sha256 - - Sha1: Sha1 - Sha256: Sha256 - Signature: - CheckAuthenticode: true - ElevationKind: AutoApprove - Id: Id - Asker: - Path: - Kind: Equals - Data: Data - WorkingDirectory: - Kind: Equals - Data: Data - CommandLine: - - Kind: Equals - Data: Data - - Kind: Equals - Data: Data - Hashes: - - Sha1: Sha1 - Sha256: Sha256 - - Sha1: Sha1 - Sha256: Sha256 - Signature: - CheckAuthenticode: true - Name: Name - properties: - Asker: - $ref: '#/components/schemas/ApplicationFilter' - ElevationKind: - $ref: '#/components/schemas/ElevationKind' - Id: - type: string - Name: - type: string - Target: - $ref: '#/components/schemas/ApplicationFilter' - required: - - ElevationKind - - Id - - Name - - Target SessionElevationConfiguration: example: Enabled: true @@ -1066,14 +830,6 @@ components: $ref: '#/components/schemas/AuthenticodeSignatureStatus' required: - Status - SignatureFilter: - example: - CheckAuthenticode: true - properties: - CheckAuthenticode: - type: boolean - required: - - CheckAuthenticode Signer: example: Issuer: Issuer @@ -1174,26 +930,6 @@ components: - Elevated - Session - Temporary - StringFilter: - example: - Kind: Equals - Data: Data - properties: - Data: - type: string - Kind: - $ref: '#/components/schemas/StringFilterKind' - required: - - Data - - Kind - StringFilterKind: - enum: - - Equals - - Regex - - StartsWith - - EndsWith - - Contains - type: string TemporaryElevationConfiguration: example: MaximumSeconds: 0 diff --git a/crates/devolutions-pedm/openapi/dotnet-client/config.json b/crates/devolutions-pedm/openapi/dotnet-client/config.json index b3cd82921..61e8e2f17 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/config.json +++ b/crates/devolutions-pedm/openapi/dotnet-client/config.json @@ -2,7 +2,7 @@ "packageAuthors": "Devolutions Inc.", "packageName": "Devolutions.Pedm.Client", "packageTitle": "Devolutions PEDM REST API Client", - "packageVersion": "2024.8.13", + "packageVersion": "2024.10.25", "packageDescription": "Client for Devolutions PEDM REST API", "packageGuid": "0eb49e08-5842-4a2e-a5ac-926e6dd65c15", "packageCopyright": "© Devolutions Inc. All rights reserved.", diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/ApplicationFilter.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/ApplicationFilter.md deleted file mode 100644 index 45e9efbfc..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/ApplicationFilter.md +++ /dev/null @@ -1,14 +0,0 @@ -# Devolutions.Pedm.Client.Model.ApplicationFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**CommandLine** | [**List<StringFilter>**](StringFilter.md) | | [optional] -**Hashes** | [**List<HashFilter>**](HashFilter.md) | | [optional] -**Path** | [**PathFilter**](PathFilter.md) | | -**Signature** | [**SignatureFilter**](SignatureFilter.md) | | [optional] -**WorkingDirectory** | [**PathFilter**](PathFilter.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/DefaultApi.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/DefaultApi.md index 00df10ff3..5a87eb990 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/DefaultApi.md +++ b/crates/devolutions-pedm/openapi/dotnet-client/docs/DefaultApi.md @@ -17,11 +17,6 @@ All URIs are relative to *http://localhost* | [**PolicyProfilesIdGet**](DefaultApi.md#policyprofilesidget) | **GET** /policy/profiles/{id} | | | [**PolicyProfilesIdPut**](DefaultApi.md#policyprofilesidput) | **PUT** /policy/profiles/{id} | | | [**PolicyProfilesPost**](DefaultApi.md#policyprofilespost) | **POST** /policy/profiles | | -| [**PolicyRulesGet**](DefaultApi.md#policyrulesget) | **GET** /policy/rules | | -| [**PolicyRulesIdDelete**](DefaultApi.md#policyrulesiddelete) | **DELETE** /policy/rules/{id} | | -| [**PolicyRulesIdGet**](DefaultApi.md#policyrulesidget) | **GET** /policy/rules/{id} | | -| [**PolicyRulesIdPut**](DefaultApi.md#policyrulesidput) | **PUT** /policy/rules/{id} | | -| [**PolicyRulesPost**](DefaultApi.md#policyrulespost) | **POST** /policy/rules | | | [**RevokePost**](DefaultApi.md#revokepost) | **POST** /revoke | | | [**StatusGet**](DefaultApi.md#statusget) | **GET** /status | | @@ -1164,451 +1159,6 @@ No authorization required - **Accept**: application/json -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | no content | - | -| **0** | | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **PolicyRulesGet** -> List<string> PolicyRulesGet () - - - -### Example -```csharp -using System.Collections.Generic; -using System.Diagnostics; -using System.Net.Http; -using Devolutions.Pedm.Client.Api; -using Devolutions.Pedm.Client.Client; -using Devolutions.Pedm.Client.Model; - -namespace Example -{ - public class PolicyRulesGetExample - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://localhost"; - // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes - HttpClient httpClient = new HttpClient(); - HttpClientHandler httpClientHandler = new HttpClientHandler(); - var apiInstance = new DefaultApi(httpClient, config, httpClientHandler); - - try - { - List result = apiInstance.PolicyRulesGet(); - Debug.WriteLine(result); - } - catch (ApiException e) - { - Debug.Print("Exception when calling DefaultApi.PolicyRulesGet: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the PolicyRulesGetWithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - ApiResponse> response = apiInstance.PolicyRulesGetWithHttpInfo(); - Debug.Write("Status Code: " + response.StatusCode); - Debug.Write("Response Headers: " + response.Headers); - Debug.Write("Response Body: " + response.Data); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling DefaultApi.PolicyRulesGetWithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters -This endpoint does not need any parameter. -### Return type - -**List** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | | - | -| **0** | | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **PolicyRulesIdDelete** -> void PolicyRulesIdDelete (string id) - - - -### Example -```csharp -using System.Collections.Generic; -using System.Diagnostics; -using System.Net.Http; -using Devolutions.Pedm.Client.Api; -using Devolutions.Pedm.Client.Client; -using Devolutions.Pedm.Client.Model; - -namespace Example -{ - public class PolicyRulesIdDeleteExample - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://localhost"; - // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes - HttpClient httpClient = new HttpClient(); - HttpClientHandler httpClientHandler = new HttpClientHandler(); - var apiInstance = new DefaultApi(httpClient, config, httpClientHandler); - var id = "id_example"; // string | - - try - { - apiInstance.PolicyRulesIdDelete(id); - } - catch (ApiException e) - { - Debug.Print("Exception when calling DefaultApi.PolicyRulesIdDelete: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the PolicyRulesIdDeleteWithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - apiInstance.PolicyRulesIdDeleteWithHttpInfo(id); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling DefaultApi.PolicyRulesIdDeleteWithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------|------|-------------|-------| -| **id** | **string** | | | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | no content | - | -| **0** | | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **PolicyRulesIdGet** -> Rule PolicyRulesIdGet (string id) - - - -### Example -```csharp -using System.Collections.Generic; -using System.Diagnostics; -using System.Net.Http; -using Devolutions.Pedm.Client.Api; -using Devolutions.Pedm.Client.Client; -using Devolutions.Pedm.Client.Model; - -namespace Example -{ - public class PolicyRulesIdGetExample - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://localhost"; - // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes - HttpClient httpClient = new HttpClient(); - HttpClientHandler httpClientHandler = new HttpClientHandler(); - var apiInstance = new DefaultApi(httpClient, config, httpClientHandler); - var id = "id_example"; // string | - - try - { - Rule result = apiInstance.PolicyRulesIdGet(id); - Debug.WriteLine(result); - } - catch (ApiException e) - { - Debug.Print("Exception when calling DefaultApi.PolicyRulesIdGet: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the PolicyRulesIdGetWithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - ApiResponse response = apiInstance.PolicyRulesIdGetWithHttpInfo(id); - Debug.Write("Status Code: " + response.StatusCode); - Debug.Write("Response Headers: " + response.Headers); - Debug.Write("Response Body: " + response.Data); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling DefaultApi.PolicyRulesIdGetWithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------|------|-------------|-------| -| **id** | **string** | | | - -### Return type - -[**Rule**](Rule.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | | - | -| **0** | | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **PolicyRulesIdPut** -> void PolicyRulesIdPut (string id, Rule rule) - - - -### Example -```csharp -using System.Collections.Generic; -using System.Diagnostics; -using System.Net.Http; -using Devolutions.Pedm.Client.Api; -using Devolutions.Pedm.Client.Client; -using Devolutions.Pedm.Client.Model; - -namespace Example -{ - public class PolicyRulesIdPutExample - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://localhost"; - // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes - HttpClient httpClient = new HttpClient(); - HttpClientHandler httpClientHandler = new HttpClientHandler(); - var apiInstance = new DefaultApi(httpClient, config, httpClientHandler); - var id = "id_example"; // string | - var rule = new Rule(); // Rule | - - try - { - apiInstance.PolicyRulesIdPut(id, rule); - } - catch (ApiException e) - { - Debug.Print("Exception when calling DefaultApi.PolicyRulesIdPut: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the PolicyRulesIdPutWithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - apiInstance.PolicyRulesIdPutWithHttpInfo(id, rule); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling DefaultApi.PolicyRulesIdPutWithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------|------|-------------|-------| -| **id** | **string** | | | -| **rule** | [**Rule**](Rule.md) | | | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | no content | - | -| **0** | | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **PolicyRulesPost** -> void PolicyRulesPost (Rule rule) - - - -### Example -```csharp -using System.Collections.Generic; -using System.Diagnostics; -using System.Net.Http; -using Devolutions.Pedm.Client.Api; -using Devolutions.Pedm.Client.Client; -using Devolutions.Pedm.Client.Model; - -namespace Example -{ - public class PolicyRulesPostExample - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://localhost"; - // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes - HttpClient httpClient = new HttpClient(); - HttpClientHandler httpClientHandler = new HttpClientHandler(); - var apiInstance = new DefaultApi(httpClient, config, httpClientHandler); - var rule = new Rule(); // Rule | - - try - { - apiInstance.PolicyRulesPost(rule); - } - catch (ApiException e) - { - Debug.Print("Exception when calling DefaultApi.PolicyRulesPost: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the PolicyRulesPostWithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - apiInstance.PolicyRulesPostWithHttpInfo(rule); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling DefaultApi.PolicyRulesPostWithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------|------|-------------|-------| -| **rule** | [**Rule**](Rule.md) | | | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/HashFilter.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/HashFilter.md deleted file mode 100644 index 00d7e238f..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/HashFilter.md +++ /dev/null @@ -1,11 +0,0 @@ -# Devolutions.Pedm.Client.Model.HashFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Sha1** | **string** | | [optional] -**Sha256** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/PathFilter.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/PathFilter.md deleted file mode 100644 index 6d819ccc2..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/PathFilter.md +++ /dev/null @@ -1,11 +0,0 @@ -# Devolutions.Pedm.Client.Model.PathFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | **string** | | -**Kind** | **PathFilterKind** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/PathFilterKind.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/PathFilterKind.md deleted file mode 100644 index 8ffcd6731..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/PathFilterKind.md +++ /dev/null @@ -1,9 +0,0 @@ -# Devolutions.Pedm.Client.Model.PathFilterKind - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/Profile.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/Profile.md index dac9a70c2..5a21f68c5 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/Profile.md +++ b/crates/devolutions-pedm/openapi/dotnet-client/docs/Profile.md @@ -10,7 +10,6 @@ Name | Type | Description | Notes **Id** | **string** | | [optional] **Name** | **string** | | [optional] [default to "Unnamed profile"] **PromptSecureDesktop** | **bool** | | [optional] [default to true] -**Rules** | **List<string>** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/Rule.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/Rule.md deleted file mode 100644 index 2ac558eae..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/Rule.md +++ /dev/null @@ -1,14 +0,0 @@ -# Devolutions.Pedm.Client.Model.Rule - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Asker** | [**ApplicationFilter**](ApplicationFilter.md) | | [optional] -**ElevationKind** | **ElevationKind** | | -**Id** | **string** | | -**Name** | **string** | | -**Target** | [**ApplicationFilter**](ApplicationFilter.md) | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/SignatureFilter.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/SignatureFilter.md deleted file mode 100644 index 375c7a1d0..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/SignatureFilter.md +++ /dev/null @@ -1,10 +0,0 @@ -# Devolutions.Pedm.Client.Model.SignatureFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**CheckAuthenticode** | **bool** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/StringFilter.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/StringFilter.md deleted file mode 100644 index 1f34b0401..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/StringFilter.md +++ /dev/null @@ -1,11 +0,0 @@ -# Devolutions.Pedm.Client.Model.StringFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | **string** | | -**Kind** | **StringFilterKind** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/crates/devolutions-pedm/openapi/dotnet-client/docs/StringFilterKind.md b/crates/devolutions-pedm/openapi/dotnet-client/docs/StringFilterKind.md deleted file mode 100644 index b25ad0c74..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/docs/StringFilterKind.md +++ /dev/null @@ -1,9 +0,0 @@ -# Devolutions.Pedm.Client.Model.StringFilterKind - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Api/DefaultApi.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Api/DefaultApi.cs index abbf0aaa9..4d4b34551 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Api/DefaultApi.cs +++ b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Api/DefaultApi.cs @@ -258,96 +258,6 @@ public interface IDefaultApiSync : IApiAccessor /// /// /// Thrown when fails to make API call - /// List<string> - List PolicyRulesGet(); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ApiResponse of List<string> - ApiResponse> PolicyRulesGetWithHttpInfo(); - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void PolicyRulesIdDelete(string id); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse PolicyRulesIdDeleteWithHttpInfo(string id); - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Rule - Rule PolicyRulesIdGet(string id); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Rule - ApiResponse PolicyRulesIdGetWithHttpInfo(string id); - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - void PolicyRulesIdPut(string id, Rule rule); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// ApiResponse of Object(void) - ApiResponse PolicyRulesIdPutWithHttpInfo(string id, Rule rule); - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - void PolicyRulesPost(Rule rule); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - ApiResponse PolicyRulesPostWithHttpInfo(Rule rule); - /// - /// - /// - /// Thrown when fails to make API call /// void RevokePost(); @@ -686,121 +596,6 @@ public interface IDefaultApiAsync : IApiAccessor /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task of List<string> - System.Threading.Tasks.Task> PolicyRulesGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<string>) - System.Threading.Tasks.Task>> PolicyRulesGetWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task PolicyRulesIdDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> PolicyRulesIdDeleteWithHttpInfoAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of Rule - System.Threading.Tasks.Task PolicyRulesIdGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Rule) - System.Threading.Tasks.Task> PolicyRulesIdGetWithHttpInfoAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task PolicyRulesIdPutAsync(string id, Rule rule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> PolicyRulesIdPutWithHttpInfoAsync(string id, Rule rule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task PolicyRulesPostAsync(Rule rule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> PolicyRulesPostWithHttpInfoAsync(Rule rule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Cancellation Token to cancel the request. /// Task of void System.Threading.Tasks.Task RevokePostAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); @@ -2499,579 +2294,6 @@ public Devolutions.Pedm.Client.Client.ApiResponse PolicyProfilesPostWith return localVarResponse; } - /// - /// - /// - /// Thrown when fails to make API call - /// List<string> - public List PolicyRulesGet() - { - Devolutions.Pedm.Client.Client.ApiResponse> localVarResponse = PolicyRulesGetWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// ApiResponse of List<string> - public Devolutions.Pedm.Client.Client.ApiResponse> PolicyRulesGetWithHttpInfo() - { - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - - - // make the HTTP request - var localVarResponse = this.Client.Get>("/policy/rules", localVarRequestOptions, this.Configuration); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesGet", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Cancellation Token to cancel the request. - /// Task of List<string> - public async System.Threading.Tasks.Task> PolicyRulesGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - Devolutions.Pedm.Client.Client.ApiResponse> localVarResponse = await PolicyRulesGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<string>) - public async System.Threading.Tasks.Task>> PolicyRulesGetWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - - - // make the HTTP request - - var localVarResponse = await this.AsynchronousClient.GetAsync>("/policy/rules", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesGet", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - public void PolicyRulesIdDelete(string id) - { - PolicyRulesIdDeleteWithHttpInfo(id); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public Devolutions.Pedm.Client.Client.ApiResponse PolicyRulesIdDeleteWithHttpInfo(string id) - { - // verify the required parameter 'id' is set - if (id == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'id' when calling DefaultApi->PolicyRulesIdDelete"); - - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - localVarRequestOptions.PathParameters.Add("id", Devolutions.Pedm.Client.Client.ClientUtils.ParameterToString(id)); // path parameter - - - // make the HTTP request - var localVarResponse = this.Client.Delete("/policy/rules/{id}", localVarRequestOptions, this.Configuration); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesIdDelete", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task PolicyRulesIdDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - await PolicyRulesIdDeleteWithHttpInfoAsync(id, cancellationToken).ConfigureAwait(false); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> PolicyRulesIdDeleteWithHttpInfoAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // verify the required parameter 'id' is set - if (id == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'id' when calling DefaultApi->PolicyRulesIdDelete"); - - - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - localVarRequestOptions.PathParameters.Add("id", Devolutions.Pedm.Client.Client.ClientUtils.ParameterToString(id)); // path parameter - - - // make the HTTP request - - var localVarResponse = await this.AsynchronousClient.DeleteAsync("/policy/rules/{id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesIdDelete", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Rule - public Rule PolicyRulesIdGet(string id) - { - Devolutions.Pedm.Client.Client.ApiResponse localVarResponse = PolicyRulesIdGetWithHttpInfo(id); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Rule - public Devolutions.Pedm.Client.Client.ApiResponse PolicyRulesIdGetWithHttpInfo(string id) - { - // verify the required parameter 'id' is set - if (id == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'id' when calling DefaultApi->PolicyRulesIdGet"); - - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - localVarRequestOptions.PathParameters.Add("id", Devolutions.Pedm.Client.Client.ClientUtils.ParameterToString(id)); // path parameter - - - // make the HTTP request - var localVarResponse = this.Client.Get("/policy/rules/{id}", localVarRequestOptions, this.Configuration); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesIdGet", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of Rule - public async System.Threading.Tasks.Task PolicyRulesIdGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - Devolutions.Pedm.Client.Client.ApiResponse localVarResponse = await PolicyRulesIdGetWithHttpInfoAsync(id, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Rule) - public async System.Threading.Tasks.Task> PolicyRulesIdGetWithHttpInfoAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // verify the required parameter 'id' is set - if (id == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'id' when calling DefaultApi->PolicyRulesIdGet"); - - - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - localVarRequestOptions.PathParameters.Add("id", Devolutions.Pedm.Client.Client.ClientUtils.ParameterToString(id)); // path parameter - - - // make the HTTP request - - var localVarResponse = await this.AsynchronousClient.GetAsync("/policy/rules/{id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesIdGet", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// - public void PolicyRulesIdPut(string id, Rule rule) - { - PolicyRulesIdPutWithHttpInfo(id, rule); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// ApiResponse of Object(void) - public Devolutions.Pedm.Client.Client.ApiResponse PolicyRulesIdPutWithHttpInfo(string id, Rule rule) - { - // verify the required parameter 'id' is set - if (id == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'id' when calling DefaultApi->PolicyRulesIdPut"); - - // verify the required parameter 'rule' is set - if (rule == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'rule' when calling DefaultApi->PolicyRulesIdPut"); - - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - localVarRequestOptions.PathParameters.Add("id", Devolutions.Pedm.Client.Client.ClientUtils.ParameterToString(id)); // path parameter - localVarRequestOptions.Data = rule; - - - // make the HTTP request - var localVarResponse = this.Client.Put("/policy/rules/{id}", localVarRequestOptions, this.Configuration); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesIdPut", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task PolicyRulesIdPutAsync(string id, Rule rule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - await PolicyRulesIdPutWithHttpInfoAsync(id, rule, cancellationToken).ConfigureAwait(false); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> PolicyRulesIdPutWithHttpInfoAsync(string id, Rule rule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // verify the required parameter 'id' is set - if (id == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'id' when calling DefaultApi->PolicyRulesIdPut"); - - // verify the required parameter 'rule' is set - if (rule == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'rule' when calling DefaultApi->PolicyRulesIdPut"); - - - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - localVarRequestOptions.PathParameters.Add("id", Devolutions.Pedm.Client.Client.ClientUtils.ParameterToString(id)); // path parameter - localVarRequestOptions.Data = rule; - - - // make the HTTP request - - var localVarResponse = await this.AsynchronousClient.PutAsync("/policy/rules/{id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesIdPut", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - public void PolicyRulesPost(Rule rule) - { - PolicyRulesPostWithHttpInfo(rule); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// ApiResponse of Object(void) - public Devolutions.Pedm.Client.Client.ApiResponse PolicyRulesPostWithHttpInfo(Rule rule) - { - // verify the required parameter 'rule' is set - if (rule == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'rule' when calling DefaultApi->PolicyRulesPost"); - - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - localVarRequestOptions.Data = rule; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/policy/rules", localVarRequestOptions, this.Configuration); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesPost", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task PolicyRulesPostAsync(Rule rule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - await PolicyRulesPostWithHttpInfoAsync(rule, cancellationToken).ConfigureAwait(false); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> PolicyRulesPostWithHttpInfoAsync(Rule rule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // verify the required parameter 'rule' is set - if (rule == null) - throw new Devolutions.Pedm.Client.Client.ApiException(400, "Missing required parameter 'rule' when calling DefaultApi->PolicyRulesPost"); - - - Devolutions.Pedm.Client.Client.RequestOptions localVarRequestOptions = new Devolutions.Pedm.Client.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - - var localVarContentType = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - - var localVarAccept = Devolutions.Pedm.Client.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - - localVarRequestOptions.Data = rule; - - - // make the HTTP request - - var localVarResponse = await this.AsynchronousClient.PostAsync("/policy/rules", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PolicyRulesPost", localVarResponse); - if (_exception != null) throw _exception; - } - - return localVarResponse; - } - /// /// /// diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Client/Configuration.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Client/Configuration.cs index 476a97cac..50f538a42 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Client/Configuration.cs +++ b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Client/Configuration.cs @@ -32,7 +32,7 @@ public class Configuration : IReadableConfiguration /// Version of the package. /// /// Version of the package. - public const string Version = "2024.8.13"; + public const string Version = "2024.10.25"; /// /// Identifier for ISO 8601 DateTime Format @@ -54,7 +54,7 @@ public class Configuration : IReadableConfiguration if (status >= 400) { return new ApiException(status, - string.Format("Error calling {0}: {1}", methodName, response.RawContent), + string.Format("Error calling {0}: HTTP status code {1}", methodName, status), response.RawContent, response.Headers); } if (status == 0) @@ -116,7 +116,7 @@ public class Configuration : IReadableConfiguration public Configuration() { Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/2024.8.13/csharp"); + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/2024.10.25/csharp"); BasePath = "http://localhost"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); @@ -539,7 +539,7 @@ public static string ToDebugReport() report += " OS: " + System.Environment.OSVersion + "\n"; report += " .NET Framework Version: " + System.Environment.Version + "\n"; report += " Version of the API: \n"; - report += " SDK Package Version: 2024.8.13\n"; + report += " SDK Package Version: 2024.10.25\n"; return report; } diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Devolutions.Pedm.Client.csproj b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Devolutions.Pedm.Client.csproj index 7d0e28037..478bf24cb 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Devolutions.Pedm.Client.csproj +++ b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Devolutions.Pedm.Client.csproj @@ -1,7 +1,7 @@ - false + true net8.0;net48 Devolutions.Pedm.Client Devolutions.Pedm.Client @@ -12,12 +12,14 @@ Client for Devolutions PEDM REST API © Devolutions Inc. All rights reserved. Devolutions.Pedm.Client - 2024.8.13 + 2024.10.25 bin\$(Configuration)\$(TargetFramework)\Devolutions.Pedm.Client.xml + MIT OR Apache-2.0 https://github.com/Devolutions/devolutions-gateway.git git Minor update - false + true + snupkg diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ApplicationFilter.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ApplicationFilter.cs deleted file mode 100644 index df98325df..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ApplicationFilter.cs +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using FileParameter = Devolutions.Pedm.Client.Client.FileParameter; -using OpenAPIDateConverter = Devolutions.Pedm.Client.Client.OpenAPIDateConverter; - -namespace Devolutions.Pedm.Client.Model -{ - /// - /// ApplicationFilter - /// - [DataContract(Name = "ApplicationFilter")] - public partial class ApplicationFilter : IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected ApplicationFilter() { } - /// - /// Initializes a new instance of the class. - /// - /// commandLine. - /// hashes. - /// path (required). - /// signature. - /// workingDirectory. - public ApplicationFilter(List commandLine = default(List), List hashes = default(List), PathFilter path = default(PathFilter), SignatureFilter signature = default(SignatureFilter), PathFilter workingDirectory = default(PathFilter)) - { - // to ensure "path" is required (not null) - if (path == null) - { - throw new ArgumentNullException("path is a required property for ApplicationFilter and cannot be null"); - } - this.Path = path; - this.CommandLine = commandLine; - this.Hashes = hashes; - this.Signature = signature; - this.WorkingDirectory = workingDirectory; - } - - /// - /// Gets or Sets CommandLine - /// - [DataMember(Name = "CommandLine", EmitDefaultValue = false)] - public List CommandLine { get; set; } - - /// - /// Gets or Sets Hashes - /// - [DataMember(Name = "Hashes", EmitDefaultValue = false)] - public List Hashes { get; set; } - - /// - /// Gets or Sets Path - /// - [DataMember(Name = "Path", IsRequired = true, EmitDefaultValue = true)] - public PathFilter Path { get; set; } - - /// - /// Gets or Sets Signature - /// - [DataMember(Name = "Signature", EmitDefaultValue = false)] - public SignatureFilter Signature { get; set; } - - /// - /// Gets or Sets WorkingDirectory - /// - [DataMember(Name = "WorkingDirectory", EmitDefaultValue = false)] - public PathFilter WorkingDirectory { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class ApplicationFilter {\n"); - sb.Append(" CommandLine: ").Append(CommandLine).Append("\n"); - sb.Append(" Hashes: ").Append(Hashes).Append("\n"); - sb.Append(" Path: ").Append(Path).Append("\n"); - sb.Append(" Signature: ").Append(Signature).Append("\n"); - sb.Append(" WorkingDirectory: ").Append(WorkingDirectory).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/AuthenticodeSignatureStatus.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/AuthenticodeSignatureStatus.cs index ef438916a..cba257750 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/AuthenticodeSignatureStatus.cs +++ b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/AuthenticodeSignatureStatus.cs @@ -68,4 +68,31 @@ public enum AuthenticodeSignatureStatus NotTrusted = 6 } + public static class AuthenticodeSignatureStatusExtensions + { + /// + /// Returns the value as string for a given variant + /// + public static string ToValue(this AuthenticodeSignatureStatus variant) + { + switch (variant) + { + case AuthenticodeSignatureStatus.Valid: + return "Valid"; + case AuthenticodeSignatureStatus.Incompatible: + return "Incompatible"; + case AuthenticodeSignatureStatus.NotSigned: + return "NotSigned"; + case AuthenticodeSignatureStatus.HashMismatch: + return "HashMismatch"; + case AuthenticodeSignatureStatus.NotSupportedFileFormat: + return "NotSupportedFileFormat"; + case AuthenticodeSignatureStatus.NotTrusted: + return "NotTrusted"; + default: + throw new ArgumentOutOfRangeException(nameof(variant), $"Unexpected variant: {variant}"); + } + } + } + } diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ElevationKind.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ElevationKind.cs index 7ff160359..3428d6ad8 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ElevationKind.cs +++ b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ElevationKind.cs @@ -56,4 +56,27 @@ public enum ElevationKind Deny = 4 } + public static class ElevationKindExtensions + { + /// + /// Returns the value as string for a given variant + /// + public static string ToValue(this ElevationKind variant) + { + switch (variant) + { + case ElevationKind.AutoApprove: + return "AutoApprove"; + case ElevationKind.Confirm: + return "Confirm"; + case ElevationKind.ReasonApproval: + return "ReasonApproval"; + case ElevationKind.Deny: + return "Deny"; + default: + throw new ArgumentOutOfRangeException(nameof(variant), $"Unexpected variant: {variant}"); + } + } + } + } diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ElevationMethod.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ElevationMethod.cs index a6f2f11eb..3850a6b49 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ElevationMethod.cs +++ b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/ElevationMethod.cs @@ -44,4 +44,23 @@ public enum ElevationMethod VirtualAccount = 2 } + public static class ElevationMethodExtensions + { + /// + /// Returns the value as string for a given variant + /// + public static string ToValue(this ElevationMethod variant) + { + switch (variant) + { + case ElevationMethod.LocalAdmin: + return "LocalAdmin"; + case ElevationMethod.VirtualAccount: + return "VirtualAccount"; + default: + throw new ArgumentOutOfRangeException(nameof(variant), $"Unexpected variant: {variant}"); + } + } + } + } diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Error.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Error.cs index 0600e5bff..35d527296 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Error.cs +++ b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Error.cs @@ -62,4 +62,29 @@ public enum Error Cancelled = 5 } + public static class ErrorExtensions + { + /// + /// Returns the value as string for a given variant + /// + public static string ToValue(this Error variant) + { + switch (variant) + { + case Error.AccessDenied: + return "AccessDenied"; + case Error.NotFound: + return "NotFound"; + case Error.InvalidParameter: + return "InvalidParameter"; + case Error.Internal: + return "Internal"; + case Error.Cancelled: + return "Cancelled"; + default: + throw new ArgumentOutOfRangeException(nameof(variant), $"Unexpected variant: {variant}"); + } + } + } + } diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/HashFilter.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/HashFilter.cs deleted file mode 100644 index 5b445d8de..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/HashFilter.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using FileParameter = Devolutions.Pedm.Client.Client.FileParameter; -using OpenAPIDateConverter = Devolutions.Pedm.Client.Client.OpenAPIDateConverter; - -namespace Devolutions.Pedm.Client.Model -{ - /// - /// HashFilter - /// - [DataContract(Name = "HashFilter")] - public partial class HashFilter : IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// sha1. - /// sha256. - public HashFilter(string sha1 = default(string), string sha256 = default(string)) - { - this.Sha1 = sha1; - this.Sha256 = sha256; - } - - /// - /// Gets or Sets Sha1 - /// - [DataMember(Name = "Sha1", EmitDefaultValue = false)] - public string Sha1 { get; set; } - - /// - /// Gets or Sets Sha256 - /// - [DataMember(Name = "Sha256", EmitDefaultValue = false)] - public string Sha256 { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class HashFilter {\n"); - sb.Append(" Sha1: ").Append(Sha1).Append("\n"); - sb.Append(" Sha256: ").Append(Sha256).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/PathFilter.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/PathFilter.cs deleted file mode 100644 index b660de87e..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/PathFilter.cs +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using FileParameter = Devolutions.Pedm.Client.Client.FileParameter; -using OpenAPIDateConverter = Devolutions.Pedm.Client.Client.OpenAPIDateConverter; - -namespace Devolutions.Pedm.Client.Model -{ - /// - /// PathFilter - /// - [DataContract(Name = "PathFilter")] - public partial class PathFilter : IValidatableObject - { - - /// - /// Gets or Sets Kind - /// - [DataMember(Name = "Kind", IsRequired = true, EmitDefaultValue = true)] - public PathFilterKind Kind { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected PathFilter() { } - /// - /// Initializes a new instance of the class. - /// - /// data (required). - /// kind (required). - public PathFilter(string data = default(string), PathFilterKind kind = default(PathFilterKind)) - { - // to ensure "data" is required (not null) - if (data == null) - { - throw new ArgumentNullException("data is a required property for PathFilter and cannot be null"); - } - this.Data = data; - this.Kind = kind; - } - - /// - /// Gets or Sets Data - /// - [DataMember(Name = "Data", IsRequired = true, EmitDefaultValue = true)] - public string Data { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class PathFilter {\n"); - sb.Append(" Data: ").Append(Data).Append("\n"); - sb.Append(" Kind: ").Append(Kind).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/PathFilterKind.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/PathFilterKind.cs deleted file mode 100644 index c70f1f925..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/PathFilterKind.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using FileParameter = Devolutions.Pedm.Client.Client.FileParameter; -using OpenAPIDateConverter = Devolutions.Pedm.Client.Client.OpenAPIDateConverter; - -namespace Devolutions.Pedm.Client.Model -{ - /// - /// Defines PathFilterKind - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum PathFilterKind - { - /// - /// Enum Equals for value: Equals - /// - [EnumMember(Value = "Equals")] - Equals = 1, - - /// - /// Enum FileName for value: FileName - /// - [EnumMember(Value = "FileName")] - FileName = 2, - - /// - /// Enum Wildcard for value: Wildcard - /// - [EnumMember(Value = "Wildcard")] - Wildcard = 3 - } - -} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Profile.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Profile.cs index b652a2ed3..872030ccf 100644 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Profile.cs +++ b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Profile.cs @@ -52,8 +52,7 @@ public partial class Profile : IValidatableObject /// id. /// name (default to "Unnamed profile"). /// promptSecureDesktop (default to true). - /// rules. - public Profile(ElevationKind? defaultElevationKind = default(ElevationKind?), ElevationMethod? elevationMethod = default(ElevationMethod?), ElevationConfigurations elevationSettings = default(ElevationConfigurations), string id = default(string), string name = @"Unnamed profile", bool promptSecureDesktop = true, List rules = default(List)) + public Profile(ElevationKind? defaultElevationKind = default(ElevationKind?), ElevationMethod? elevationMethod = default(ElevationMethod?), ElevationConfigurations elevationSettings = default(ElevationConfigurations), string id = default(string), string name = @"Unnamed profile", bool promptSecureDesktop = true) { this.DefaultElevationKind = defaultElevationKind; this.ElevationMethod = elevationMethod; @@ -62,7 +61,6 @@ public partial class Profile : IValidatableObject // use default value if no "name" provided this.Name = name ?? @"Unnamed profile"; this.PromptSecureDesktop = promptSecureDesktop; - this.Rules = rules; } /// @@ -89,12 +87,6 @@ public partial class Profile : IValidatableObject [DataMember(Name = "PromptSecureDesktop", EmitDefaultValue = true)] public bool PromptSecureDesktop { get; set; } - /// - /// Gets or Sets Rules - /// - [DataMember(Name = "Rules", EmitDefaultValue = false)] - public List Rules { get; set; } - /// /// Returns the string presentation of the object /// @@ -109,7 +101,6 @@ public override string ToString() sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PromptSecureDesktop: ").Append(PromptSecureDesktop).Append("\n"); - sb.Append(" Rules: ").Append(Rules).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Rule.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Rule.cs deleted file mode 100644 index b8a721298..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/Rule.cs +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using FileParameter = Devolutions.Pedm.Client.Client.FileParameter; -using OpenAPIDateConverter = Devolutions.Pedm.Client.Client.OpenAPIDateConverter; - -namespace Devolutions.Pedm.Client.Model -{ - /// - /// Rule - /// - [DataContract(Name = "Rule")] - public partial class Rule : IValidatableObject - { - - /// - /// Gets or Sets ElevationKind - /// - [DataMember(Name = "ElevationKind", IsRequired = true, EmitDefaultValue = true)] - public ElevationKind ElevationKind { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected Rule() { } - /// - /// Initializes a new instance of the class. - /// - /// asker. - /// elevationKind (required). - /// id (required). - /// name (required). - /// target (required). - public Rule(ApplicationFilter asker = default(ApplicationFilter), ElevationKind elevationKind = default(ElevationKind), string id = default(string), string name = default(string), ApplicationFilter target = default(ApplicationFilter)) - { - this.ElevationKind = elevationKind; - // to ensure "id" is required (not null) - if (id == null) - { - throw new ArgumentNullException("id is a required property for Rule and cannot be null"); - } - this.Id = id; - // to ensure "name" is required (not null) - if (name == null) - { - throw new ArgumentNullException("name is a required property for Rule and cannot be null"); - } - this.Name = name; - // to ensure "target" is required (not null) - if (target == null) - { - throw new ArgumentNullException("target is a required property for Rule and cannot be null"); - } - this.Target = target; - this.Asker = asker; - } - - /// - /// Gets or Sets Asker - /// - [DataMember(Name = "Asker", EmitDefaultValue = false)] - public ApplicationFilter Asker { get; set; } - - /// - /// Gets or Sets Id - /// - [DataMember(Name = "Id", IsRequired = true, EmitDefaultValue = true)] - public string Id { get; set; } - - /// - /// Gets or Sets Name - /// - [DataMember(Name = "Name", IsRequired = true, EmitDefaultValue = true)] - public string Name { get; set; } - - /// - /// Gets or Sets Target - /// - [DataMember(Name = "Target", IsRequired = true, EmitDefaultValue = true)] - public ApplicationFilter Target { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class Rule {\n"); - sb.Append(" Asker: ").Append(Asker).Append("\n"); - sb.Append(" ElevationKind: ").Append(ElevationKind).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" Target: ").Append(Target).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/SignatureFilter.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/SignatureFilter.cs deleted file mode 100644 index cd589ec06..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/SignatureFilter.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using FileParameter = Devolutions.Pedm.Client.Client.FileParameter; -using OpenAPIDateConverter = Devolutions.Pedm.Client.Client.OpenAPIDateConverter; - -namespace Devolutions.Pedm.Client.Model -{ - /// - /// SignatureFilter - /// - [DataContract(Name = "SignatureFilter")] - public partial class SignatureFilter : IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected SignatureFilter() { } - /// - /// Initializes a new instance of the class. - /// - /// checkAuthenticode (required). - public SignatureFilter(bool checkAuthenticode = default(bool)) - { - this.CheckAuthenticode = checkAuthenticode; - } - - /// - /// Gets or Sets CheckAuthenticode - /// - [DataMember(Name = "CheckAuthenticode", IsRequired = true, EmitDefaultValue = true)] - public bool CheckAuthenticode { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class SignatureFilter {\n"); - sb.Append(" CheckAuthenticode: ").Append(CheckAuthenticode).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/StringFilter.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/StringFilter.cs deleted file mode 100644 index 8c2b38124..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/StringFilter.cs +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using FileParameter = Devolutions.Pedm.Client.Client.FileParameter; -using OpenAPIDateConverter = Devolutions.Pedm.Client.Client.OpenAPIDateConverter; - -namespace Devolutions.Pedm.Client.Model -{ - /// - /// StringFilter - /// - [DataContract(Name = "StringFilter")] - public partial class StringFilter : IValidatableObject - { - - /// - /// Gets or Sets Kind - /// - [DataMember(Name = "Kind", IsRequired = true, EmitDefaultValue = true)] - public StringFilterKind Kind { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected StringFilter() { } - /// - /// Initializes a new instance of the class. - /// - /// data (required). - /// kind (required). - public StringFilter(string data = default(string), StringFilterKind kind = default(StringFilterKind)) - { - // to ensure "data" is required (not null) - if (data == null) - { - throw new ArgumentNullException("data is a required property for StringFilter and cannot be null"); - } - this.Data = data; - this.Kind = kind; - } - - /// - /// Gets or Sets Data - /// - [DataMember(Name = "Data", IsRequired = true, EmitDefaultValue = true)] - public string Data { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class StringFilter {\n"); - sb.Append(" Data: ").Append(Data).Append("\n"); - sb.Append(" Kind: ").Append(Kind).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/StringFilterKind.cs b/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/StringFilterKind.cs deleted file mode 100644 index 07f80d4f8..000000000 --- a/crates/devolutions-pedm/openapi/dotnet-client/src/Devolutions.Pedm.Client/Model/StringFilterKind.cs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Devolutions PEDM API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using FileParameter = Devolutions.Pedm.Client.Client.FileParameter; -using OpenAPIDateConverter = Devolutions.Pedm.Client.Client.OpenAPIDateConverter; - -namespace Devolutions.Pedm.Client.Model -{ - /// - /// Defines StringFilterKind - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum StringFilterKind - { - /// - /// Enum Equals for value: Equals - /// - [EnumMember(Value = "Equals")] - Equals = 1, - - /// - /// Enum Regex for value: Regex - /// - [EnumMember(Value = "Regex")] - Regex = 2, - - /// - /// Enum StartsWith for value: StartsWith - /// - [EnumMember(Value = "StartsWith")] - StartsWith = 3, - - /// - /// Enum EndsWith for value: EndsWith - /// - [EnumMember(Value = "EndsWith")] - EndsWith = 4, - - /// - /// Enum Contains for value: Contains - /// - [EnumMember(Value = "Contains")] - Contains = 5 - } - -} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/templates/Configuration.mustache b/crates/devolutions-pedm/openapi/dotnet-client/templates/Configuration.mustache new file mode 100644 index 000000000..8384eb36f --- /dev/null +++ b/crates/devolutions-pedm/openapi/dotnet-client/templates/Configuration.mustache @@ -0,0 +1,730 @@ +{{>partial_header}} + +using System; +{{^net35}} +using System.Collections.Concurrent; +{{/net35}} +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; +{{#useRestSharp}} +{{#hasOAuthMethods}}using {{packageName}}.Client.Auth; +{{/hasOAuthMethods}} +{{/useRestSharp}} + +namespace {{packageName}}.Client +{ + /// + /// Represents a set of configuration settings + /// + {{>visibility}} class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "{{packageVersion}}"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: HTTP status code {1}", methodName, status), + response.RawContent, response.Headers); + } + {{^netStandard}} + if (status == 0) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.ErrorText), response.ErrorText); + } + {{/netStandard}} + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + {{#servers.0}} + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + {{/servers.0}} + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + {{#hasHttpSignatureMethods}} + + /// + /// HttpSigning configuration + /// + private HttpSigningConfiguration _HttpSigningConfiguration = null; + {{/hasHttpSignatureMethods}} + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("{{httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{packageVersion}}/csharp{{/httpUserAgent}}"); + BasePath = "{{{basePath}}}"; + DefaultHeaders = new {{^net35}}Concurrent{{/net35}}Dictionary(); + ApiKey = new {{^net35}}Concurrent{{/net35}}Dictionary(); + ApiKeyPrefix = new {{^net35}}Concurrent{{/net35}}Dictionary(); + {{#servers}} + {{#-first}} + Servers = new List>() + { + {{/-first}} + { + new Dictionary { + {"url", "{{{url}}}"}, + {"description", "{{{description}}}{{^description}}No description provided{{/description}}"}, + {{#variables}} + {{#-first}} + { + "variables", new Dictionary { + {{/-first}} + { + "{{{name}}}", new Dictionary { + {"description", "{{{description}}}{{^description}}No description provided{{/description}}"}, + {"default_value", {{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}"{{{defaultValue}}}"}, + {{#enumValues}} + {{#-first}} + { + "enum_values", new List() { + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + } + } + {{/-last}} + {{/enumValues}} + } + }{{^-last}},{{/-last}} + {{#-last}} + } + } + {{/-last}} + {{/variables}} + } + }{{^-last}},{{/-last}} + {{#-last}} + }; + {{/-last}} + {{/servers}} + OperationServers = new Dictionary>>() + { + {{#apiInfo}} + {{#apis}} + {{#operations}} + {{#operation}} + {{#servers.0}} + { + "{{{classname}}}.{{{nickname}}}", new List> + { + {{#servers}} + { + new Dictionary + { + {"url", "{{{url}}}"}, + {"description", "{{{description}}}{{^description}}No description provided{{/description}}"} + } + }, + {{/servers}} + } + }, + {{/servers.0}} + {{/operation}} + {{/operations}} + {{/apis}} + {{/apiInfo}} + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "{{{basePath}}}") : this() + { + if (string.{{^net35}}IsNullOrWhiteSpace{{/net35}}{{#net35}}IsNullOrEmpty{{/net35}}(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets certificate collection to be sent with requests. + /// + /// X509 Certificate collection. + public X509CertificateCollection ClientCertificates { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// This helper property simplifies code generation. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + {{#useRestSharp}} + {{#hasOAuthMethods}} + /// + /// Gets or sets the token URL for OAuth2 authentication. + /// + /// The OAuth Token URL. + public virtual string OAuthTokenUrl { get; set; } + + /// + /// Gets or sets the client ID for OAuth2 authentication. + /// + /// The OAuth Client ID. + public virtual string OAuthClientId { get; set; } + + /// + /// Gets or sets the client secret for OAuth2 authentication. + /// + /// The OAuth Client Secret. + public virtual string OAuthClientSecret { get; set; } + + /// + /// Gets or sets the flow for OAuth2 authentication. + /// + /// The OAuth Flow. + public virtual OAuthFlow? OAuthFlow { get; set; } + + {{/hasOAuthMethods}} + {{/useRestSharp}} + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + {{#servers.0}} + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + {{/servers.0}} + {{#hasHttpSignatureMethods}} + + /// + /// Gets and Sets the HttpSigningConfiguration + /// + public HttpSigningConfiguration HttpSigningConfiguration + { + get { return _HttpSigningConfiguration; } + set { _HttpSigningConfiguration = value; } + } + {{/hasHttpSignatureMethods}} + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK ({{{packageName}}}) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: {{{version}}}\n"; + report += " SDK Package Version: {{{packageVersion}}}\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + Username = second.Username ?? first.Username, + Password = second.Password ?? first.Password, + AccessToken = second.AccessToken ?? first.AccessToken, + {{#useRestSharp}} + {{#hasOAuthMethods}} + OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, + OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, + OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, + OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, + {{/hasOAuthMethods}} + {{/useRestSharp}} + {{#hasHttpSignatureMethods}} + HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration, + {{/hasHttpSignatureMethods}} + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + ClientCertificates = second.ClientCertificates ?? first.ClientCertificates, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/templates/modelEnum.mustache b/crates/devolutions-pedm/openapi/dotnet-client/templates/modelEnum.mustache new file mode 100644 index 000000000..10099631c --- /dev/null +++ b/crates/devolutions-pedm/openapi/dotnet-client/templates/modelEnum.mustache @@ -0,0 +1,208 @@ + /// + /// {{description}}{{^description}}Defines {{{name}}}{{/description}} + /// + {{#description}} + /// {{.}} + {{/description}} + {{#vendorExtensions.x-cls-compliant}} + [CLSCompliant({{{.}}})] + {{/vendorExtensions.x-cls-compliant}} + {{#vendorExtensions.x-com-visible}} + [ComVisible({{{.}}})] + {{/vendorExtensions.x-com-visible}} + {{#allowableValues}} + {{#enumVars}} + {{#-first}} + {{#isString}} + {{^useGenericHost}} + [JsonConverter(typeof(StringEnumConverter))] + {{/useGenericHost}} + {{/isString}} + {{/-first}} + {{/enumVars}} + {{/allowableValues}} + {{>visibility}} enum {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}} + { + {{#allowableValues}} + {{#enumVars}} + /// + /// Enum {{name}} for value: {{value}} + /// + {{#isString}} + {{^useGenericHost}} + {{! EnumMember not currently supported in System.Text.Json, use a converter instead }} + [EnumMember(Value = "{{{value}}}")] + {{/useGenericHost}} + {{/isString}} + {{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}}{{^vendorExtensions.x-zero-based-enum}} = {{-index}}{{/vendorExtensions.x-zero-based-enum}}{{/isString}}{{^-last}},{{/-last}} + {{^-last}} + + {{/-last}} + {{/enumVars}} + {{/allowableValues}} + } + {{#useGenericHost}} + + /// + /// Converts to and from the JSON value + /// + public static class {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}ValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} FromString(string value) + { + {{#allowableValues}} + {{#enumVars}} + if (value.Equals({{^isString}}({{{value}}}).ToString(){{/isString}}{{#isString}}"{{{value}}}"{{/isString}})) + return {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.{{name}}; + + {{/enumVars}} + {{/allowableValues}} + throw new NotImplementedException($"Could not convert value to type {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}? FromStringOrDefault(string value) + { + {{#allowableValues}} + {{#enumVars}} + if (value.Equals({{^isString}}({{{value}}}).ToString(){{/isString}}{{#isString}}"{{{value}}}"{{/isString}})) + return {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.{{name}}; + + {{/enumVars}} + {{/allowableValues}} + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static {{>EnumValueDataType}} ToJsonValue({{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} value) + { + {{^isString}} + return ({{>EnumValueDataType}}) value; + {{/isString}} + {{#isString}} + {{#allowableValues}} + {{#enumVars}} + if (value == {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.{{name}}) + return {{^isNumeric}}"{{/isNumeric}}{{{value}}}{{^isNumeric}}"{{/isNumeric}}; + + {{/enumVars}} + {{/allowableValues}} + throw new NotImplementedException($"Value could not be handled: '{value}'"); + {{/isString}} + } + } + + /// + /// A Json converter for type + /// + /// + public class {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}JsonConverter : JsonConverter<{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}> + { + /// + /// Returns a {{datatypeWithEnum}} from the Json object + /// + /// + /// + /// + /// + public override {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string{{nrt?}} rawValue = reader.GetString(); + + {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}? result = rawValue == null + ? null + : {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}ValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {{#lambda.camelcase_param}}{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{/lambda.camelcase_param}}, JsonSerializerOptions options) + { + writer.WriteStringValue({{#lambda.camelcase_param}}{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{/lambda.camelcase_param}}.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}NullableJsonConverter : JsonConverter<{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}?> + { + /// + /// Returns a {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} from the Json object + /// + /// + /// + /// + /// + public override {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string{{nrt?}} rawValue = reader.GetString(); + + {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}? result = rawValue == null + ? null + : {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}ValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}? {{#lambda.camelcase_param}}{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{/lambda.camelcase_param}}, JsonSerializerOptions options) + { + writer.WriteStringValue({{#lambda.camelcase_param}}{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{/lambda.camelcase_param}}?.ToString() ?? "null"); + } + } + {{/useGenericHost}} + + {{#isString}} + {{>visibility}} static class {{classname}}Extensions + { + /// + /// Returns the value as string for a given variant + /// + {{>visibility}} static string ToValue(this {{classname}} variant) + { + switch (variant) + { + {{#allowableValues}} + {{#enumVars}} + case {{classname}}.{{name}}: + return "{{{value}}}"; + {{/enumVars}} + {{/allowableValues}} + default: + throw new ArgumentOutOfRangeException(nameof(variant), $"Unexpected variant: {variant}"); + } + } + } + {{/isString}} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/templates/netcore_project.mustache b/crates/devolutions-pedm/openapi/dotnet-client/templates/netcore_project.mustache new file mode 100644 index 000000000..cda3bcf43 --- /dev/null +++ b/crates/devolutions-pedm/openapi/dotnet-client/templates/netcore_project.mustache @@ -0,0 +1,77 @@ + + + + true + {{targetFramework}} + {{packageName}} + {{packageName}} + Library + {{packageAuthors}} + {{packageCompany}} + {{packageTitle}} + {{packageDescription}} + {{packageCopyright}} + {{packageName}} + {{packageVersion}} + bin\$(Configuration)\$(TargetFramework)\{{packageName}}.xml{{#licenseName}} + {{licenseName}}{{/licenseName}} + https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}.git + git{{#releaseNote}} + {{.}}{{/releaseNote}}{{#packageTags}} + {{{.}}}{{/packageTags}}{{#nrt}} + {{#useGenericHost}}enable{{/useGenericHost}}{{^useGenericHost}}annotations{{/useGenericHost}}{{/nrt}} + true + snupkg + + + + {{#useCompareNetObjects}} + + {{/useCompareNetObjects}} + {{^useGenericHost}} + + + {{/useGenericHost}} + {{#useRestSharp}} + + {{/useRestSharp}} + {{#useGenericHost}} + + + {{#supportsRetry}} + + {{/supportsRetry}} + {{#net80OrLater}} + + {{/net80OrLater}} + {{#netStandard}} + + {{/netStandard}} + {{/useGenericHost}} + {{^useGenericHost}} + {{#supportsRetry}} + + {{/supportsRetry}} + {{/useGenericHost}} + {{#validatable}} + {{^net60OrLater}} + + {{/net60OrLater}} + {{/validatable}} + + +{{^useGenericHost}} + + + {{#net48}} + + {{/net48}} + + + + {{#net48}} + + {{/net48}} + +{{/useGenericHost}} +{{>netcore_project.additions}} diff --git a/crates/devolutions-pedm/openapi/dotnet-client/templates/partial_header.mustache b/crates/devolutions-pedm/openapi/dotnet-client/templates/partial_header.mustache new file mode 100644 index 000000000..1562058ad --- /dev/null +++ b/crates/devolutions-pedm/openapi/dotnet-client/templates/partial_header.mustache @@ -0,0 +1,17 @@ +/* + {{#appName}} + * {{{.}}} + * + {{/appName}} + {{#appDescription}} + * {{{.}}} + * + {{/appDescription}} + {{#version}} + * The version of the OpenAPI document: {{{.}}} + {{/version}} + {{#infoEmail}} + * Contact: {{{.}}} + {{/infoEmail}} + * Generated by: https://github.com/openapitools/openapi-generator.git + */ diff --git a/crates/devolutions-pedm/openapi/dotnet-client/templates/visibility.mustache b/crates/devolutions-pedm/openapi/dotnet-client/templates/visibility.mustache new file mode 100644 index 000000000..a1d1f4163 --- /dev/null +++ b/crates/devolutions-pedm/openapi/dotnet-client/templates/visibility.mustache @@ -0,0 +1 @@ +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} \ No newline at end of file diff --git a/crates/devolutions-pedm/openapi/pedm-api.yaml b/crates/devolutions-pedm/openapi/pedm-api.yaml index b832596f7..ece35012b 100644 --- a/crates/devolutions-pedm/openapi/pedm-api.yaml +++ b/crates/devolutions-pedm/openapi/pedm-api.yaml @@ -221,101 +221,6 @@ paths: $ref: '#/components/schemas/ErrorResponse' '200': description: no content - /policy/rules: - get: - responses: - default: - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Id' - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Rule' - required: true - responses: - default: - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '200': - description: no content - /policy/rules/{id}: - get: - parameters: - - in: path - name: id - required: true - schema: - $ref: '#/components/schemas/Id' - style: simple - responses: - default: - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/Rule' - put: - parameters: - - in: path - name: id - required: true - schema: - $ref: '#/components/schemas/Id' - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Rule' - required: true - responses: - default: - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '200': - description: no content - delete: - parameters: - - in: path - name: id - required: true - schema: - $ref: '#/components/schemas/Id' - style: simple - responses: - default: - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '200': - description: no content /policy/assignments: get: responses: @@ -385,29 +290,6 @@ components: $ref: '#/components/schemas/User' WorkingDirectory: type: string - ApplicationFilter: - type: object - required: - - Path - properties: - CommandLine: - type: array - items: - $ref: '#/components/schemas/StringFilter' - nullable: true - Hashes: - type: array - items: - $ref: '#/components/schemas/HashFilter' - nullable: true - Path: - $ref: '#/components/schemas/PathFilter' - Signature: - $ref: '#/components/schemas/SignatureFilter' - nullable: true - WorkingDirectory: - $ref: '#/components/schemas/PathFilter' - nullable: true Assignment: type: object required: @@ -551,15 +433,6 @@ components: type: string Sha256: type: string - HashFilter: - type: object - properties: - Sha1: - type: string - nullable: true - Sha256: - type: string - nullable: true Id: type: string LaunchPayload: @@ -603,22 +476,6 @@ components: Id: $ref: '#/components/schemas/Id' nullable: true - PathFilter: - type: object - required: - - Data - - Kind - properties: - Data: - type: string - Kind: - $ref: '#/components/schemas/PathFilterKind' - PathFilterKind: - type: string - enum: - - Equals - - FileName - - Wildcard PathIdParameter: type: object required: @@ -652,30 +509,6 @@ components: PromptSecureDesktop: default: true type: boolean - Rules: - default: [] - type: array - items: - $ref: '#/components/schemas/Id' - Rule: - type: object - required: - - ElevationKind - - Id - - Name - - Target - properties: - Asker: - $ref: '#/components/schemas/ApplicationFilter' - nullable: true - ElevationKind: - $ref: '#/components/schemas/ElevationKind' - Id: - $ref: '#/components/schemas/Id' - Name: - type: string - Target: - $ref: '#/components/schemas/ApplicationFilter' SessionElevationConfiguration: type: object required: @@ -705,13 +538,6 @@ components: nullable: true Status: $ref: '#/components/schemas/AuthenticodeSignatureStatus' - SignatureFilter: - type: object - required: - - CheckAuthenticode - properties: - CheckAuthenticode: - type: boolean Signer: type: object required: @@ -792,24 +618,6 @@ components: $ref: '#/components/schemas/SessionElevationStatus' Temporary: $ref: '#/components/schemas/TemporaryElevationStatus' - StringFilter: - type: object - required: - - Data - - Kind - properties: - Data: - type: string - Kind: - $ref: '#/components/schemas/StringFilterKind' - StringFilterKind: - type: string - enum: - - Equals - - Regex - - StartsWith - - EndsWith - - Contains TemporaryElevationConfiguration: type: object required: diff --git a/crates/devolutions-pedm/src/api/mod.rs b/crates/devolutions-pedm/src/api/mod.rs index f4075782e..66d081959 100644 --- a/crates/devolutions-pedm/src/api/mod.rs +++ b/crates/devolutions-pedm/src/api/mod.rs @@ -62,7 +62,7 @@ struct RawNamedPipeConnectInfo { impl Connected<&NamedPipeServer> for RawNamedPipeConnectInfo { fn connect_info(target: &NamedPipeServer) -> Self { let handle = HANDLE(target.as_raw_handle().cast()); - let handle = Handle::new_borrowed(handle).expect("the handled held by NamedPipeServer is valid"); + let handle = Handle::new_borrowed(handle).expect("the handle held by NamedPipeServer is valid"); Self { handle } } } diff --git a/crates/devolutions-pedm/src/api/policy.rs b/crates/devolutions-pedm/src/api/policy.rs index b90fda81b..3d349750b 100644 --- a/crates/devolutions-pedm/src/api/policy.rs +++ b/crates/devolutions-pedm/src/api/policy.rs @@ -2,7 +2,7 @@ use aide::axum::routing::{get, put}; use aide::axum::ApiRouter; use axum::extract::Path; use axum::{Extension, Json}; -use devolutions_pedm_shared::policy::{Id, Profile, Rule, User}; +use devolutions_pedm_shared::policy::{Id, Profile, User}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use tracing::info; @@ -130,81 +130,6 @@ async fn put_me( Ok(()) } -async fn get_rules(Extension(named_pipe_info): Extension) -> Result>, Error> { - if !named_pipe_info.token.is_elevated()? { - return Err(Error::AccessDenied); - } - - let policy = policy::policy().read(); - - Ok(Json(policy.rules().map(|x| x.id.clone()).collect())) -} - -async fn get_rules_id( - Extension(named_pipe_info): Extension, - Path(id): Path, -) -> Result, Error> { - let policy = policy::policy().read(); - - // If we are not elevated, check that user has access to rule. - if !named_pipe_info.token.is_elevated()? - && policy - .user_profiles(&named_pipe_info.user) - .iter() - .all(|p| !p.rules.contains(&id.id)) - { - return Err(Error::AccessDenied); - } - - Ok(Json(policy.rule(&id.id).ok_or(Error::NotFound)?.clone())) -} - -async fn put_rules_id( - Extension(named_pipe_info): Extension, - Path(id): Path, - Json(rule): Json, -) -> Result<(), Error> { - if !named_pipe_info.token.is_elevated()? { - return Err(Error::AccessDenied); - } - - let mut policy = policy::policy().write(); - - policy.replace_rule(&id.id, rule)?; - - Ok(()) -} - -async fn delete_rules_id( - Extension(named_pipe_info): Extension, - Path(id): Path, -) -> Result<(), Error> { - if !named_pipe_info.token.is_elevated()? { - return Err(Error::AccessDenied); - } - - let mut policy = policy::policy().write(); - - policy.remove_rule(&id.id)?; - - Ok(()) -} - -async fn post_rules( - Extension(named_pipe_info): Extension, - Json(rule): Json, -) -> Result<(), Error> { - if !named_pipe_info.token.is_elevated()? { - return Err(Error::AccessDenied); - } - - let mut policy = policy::policy().write(); - - policy.add_rule(rule)?; - - Ok(()) -} - #[derive(Serialize, JsonSchema)] #[serde(rename_all = "PascalCase")] struct Assignment { @@ -261,11 +186,6 @@ pub(crate) fn policy_router() -> ApiRouter { "/profiles/:id", get(get_profiles_id).put(put_profiles_id).delete(delete_profiles_id), ) - .api_route("/rules", get(get_rules).post(post_rules)) - .api_route( - "/rules/:id", - get(get_rules_id).put(put_rules_id).delete(delete_rules_id), - ) .api_route("/assignments", get(get_assignments)) .api_route("/assignments/:id", put(put_assignments_id)) } diff --git a/crates/devolutions-pedm/src/config.rs b/crates/devolutions-pedm/src/config.rs index bcec3a632..da177d252 100644 --- a/crates/devolutions-pedm/src/config.rs +++ b/crates/devolutions-pedm/src/config.rs @@ -5,7 +5,7 @@ use camino::Utf8PathBuf; use win_api_wrappers::process::Module; use win_api_wrappers::raw::Win32::Foundation::LUID; -pub(crate) static PEDM_DESKTOP_RELPATH: &str = r"desktop/DevolutionsPedmDesktop.exe"; +pub(crate) static PEDM_DESKTOP_RELPATH: &str = r"desktop/DevolutionsDesktopAgent.exe"; pub(crate) static PIPE_NAME: &str = r"\\.\pipe\DevolutionsPEDM"; diff --git a/crates/devolutions-pedm/src/desktop.rs b/crates/devolutions-pedm/src/desktop.rs deleted file mode 100644 index efa40dbc1..000000000 --- a/crates/devolutions-pedm/src/desktop.rs +++ /dev/null @@ -1,113 +0,0 @@ -use std::io::Read; -use std::path::Path; - -use anyhow::Result; - -use win_api_wrappers::identity::sid::Sid; -use win_api_wrappers::process::{Process, StartupInfo}; -use win_api_wrappers::raw::Win32::Foundation::ERROR_BAD_ARGUMENTS; -use win_api_wrappers::raw::Win32::Security::{ - SecurityAnonymous, TokenPrimary, TOKEN_ACCESS_MASK, TOKEN_ADJUST_DEFAULT, TOKEN_ADJUST_PRIVILEGES, - TOKEN_ADJUST_SESSIONID, TOKEN_ASSIGN_PRIMARY, TOKEN_DUPLICATE, TOKEN_QUERY, -}; -use win_api_wrappers::raw::Win32::System::Threading::CREATE_SUSPENDED; -use win_api_wrappers::security::acl::SecurityAttributes; -use win_api_wrappers::thread::{ThreadAttributeList, ThreadAttributeType}; -use win_api_wrappers::utils::{CommandLine, Pipe, WideString}; - -use crate::utils::{start_process, AccountExt}; -use crate::{config, policy}; - -static SECURE_DESKTOP: &str = r"WinSta0\Winlogon"; - -fn launch_desktop( - session_id: u32, - verb: &str, - argument: Option<&str>, - user_behalf: &Sid, - secure_desktop: bool, -) -> Result> { - let mut token = Process::current_process() - .token( - TOKEN_ADJUST_SESSIONID - | TOKEN_ADJUST_DEFAULT - | TOKEN_ADJUST_PRIVILEGES - | TOKEN_QUERY - | TOKEN_DUPLICATE - | TOKEN_ASSIGN_PRIMARY, - )? - .duplicate(TOKEN_ACCESS_MASK(0), None, SecurityAnonymous, TokenPrimary)?; - - token.set_session_id(session_id)?; - - let (mut rx, tx) = Pipe::new_anonymous( - Some(&SecurityAttributes { - inherit_handle: true, - security_descriptor: None, - }), - 256, - )?; - - let mut attributes = ThreadAttributeList::with_count(1)?; - let attr = ThreadAttributeType::HandleList(vec![tx.handle.raw()]); - attributes.update(&attr)?; - - let mut startup_info = StartupInfo { - desktop: secure_desktop - .then(|| WideString::from(SECURE_DESKTOP)) - .unwrap_or_default(), - attribute_list: Some(Some(attributes.raw())), - ..Default::default() - }; - - let command_line = CommandLine::new(vec![ - config::pedm_desktop_path() - .to_str() - .ok_or_else(|| win_api_wrappers::Error::from_win32(ERROR_BAD_ARGUMENTS))? - .to_owned(), - user_behalf.to_string(), - verb.to_owned(), - format!("{}", tx.handle.raw().0 as isize), - argument.unwrap_or_default().to_owned(), - ]); - - let proc = start_process( - &token, - Some(config::pedm_desktop_path()), - Some(&command_line), - true, // Safe to inherit, as startup info has inherit list - CREATE_SUSPENDED, - None, - None, - &mut startup_info, - )?; - - drop(tx); - - proc.thread.resume()?; - - let _ = proc.process.wait(None)?; - - let mut buf = Vec::new(); - - let _ = rx.read_to_end(&mut buf); - - Ok(buf) -} - -pub(crate) fn launch_consent(session_id: u32, user_behalf: &Sid, path: &Path) -> Result { - let status = launch_desktop( - session_id, - "consent", - path.to_str(), - user_behalf, - policy::policy() - .read() - .user_current_profile(&user_behalf.account(None)?.to_user()) - .map_or(true, |x| x.prompt_secure_desktop), - )? - .first() - .is_some_and(|x| *x != 0); - - Ok(status) -} diff --git a/crates/devolutions-pedm/src/lib.rs b/crates/devolutions-pedm/src/lib.rs index 30460c039..2687370f4 100644 --- a/crates/devolutions-pedm/src/lib.rs +++ b/crates/devolutions-pedm/src/lib.rs @@ -5,7 +5,6 @@ cfg_if::cfg_if! { if #[cfg(target_os = "windows")] { pub mod api; mod config; - mod desktop; mod elevations; mod elevator; mod error; diff --git a/crates/devolutions-pedm/src/log.rs b/crates/devolutions-pedm/src/log.rs index e38c5ec29..03369b86c 100644 --- a/crates/devolutions-pedm/src/log.rs +++ b/crates/devolutions-pedm/src/log.rs @@ -7,7 +7,7 @@ use camino::Utf8PathBuf; use chrono::Local; use devolutions_pedm_shared::policy::{ElevationResult, User}; use std::fs::{self, OpenOptions}; -use std::io::{self, BufRead, Write}; +use std::io::{self, BufRead}; use walkdir::WalkDir; use win_api_wrappers::identity::sid::Sid; use win_api_wrappers::raw::Win32::Security::WinBuiltinUsersSid; @@ -39,10 +39,12 @@ pub(crate) fn log_elevation(res: &ElevationResult) -> Result<()> { log_path.push(cur_time.format("%Y_%m_%d.json").to_string()); - let mut file = OpenOptions::new().append(true).create(true).open(log_path)?; + // FIXME: Depending on log rotation, the log file may not exist + // TODO: Log to a local database rather than a file + //let mut file = OpenOptions::new().append(true).create(true).open(log_path)?; - file.write_all(serde_json::to_string(res)?.as_bytes())?; - file.write_all(b"\n")?; + //file.write_all(serde_json::to_string(res)?.as_bytes())?; + //file.write_all(b"\n")?; Ok(()) } diff --git a/crates/devolutions-pedm/src/policy.rs b/crates/devolutions-pedm/src/policy.rs index 769bee15d..880b3861c 100644 --- a/crates/devolutions-pedm/src/policy.rs +++ b/crates/devolutions-pedm/src/policy.rs @@ -1,8 +1,7 @@ //! Module in charge of loading, saving and overall management of the PEDM policy. //! -//! The policy works in 3 layers: -//! - Rules: Each rule specifies what process can launch which other process in administrator mode with some more settings. -//! - Profiles: Each profile specifies which type of elevation should be done as well as which rules are valid for that profile. +//! The policy works in 2 layers: +//! - Profiles: Each profile specifies which type of elevation should be done. //! - Assignments: A mapping between users on the machine and the profiles available to them. //! //! The policy is stored under `%ProgramData%\Devolutions\Agent\pedm\policy\`, and is only accessible by `NT AUTHORITY\SYSTEM`. @@ -11,8 +10,7 @@ use base64::prelude::BASE64_STANDARD; use base64::Engine; use camino::Utf8PathBuf; use devolutions_pedm_shared::policy::{ - Application, Certificate, Configuration, ElevationRequest, Filter, Id, Identifiable, Profile, Rule, Signature, - Signer, User, + Application, Certificate, Configuration, ElevationRequest, Id, Identifiable, Profile, Signature, Signer, User, }; use parking_lot::RwLock; use serde::de::DeserializeOwned; @@ -22,7 +20,7 @@ use std::fs::{self, File, OpenOptions}; use std::io::{BufReader, BufWriter}; use std::path::{Path, PathBuf}; use std::sync::OnceLock; -use tracing::{error, warn}; +use tracing::error; use win_api_wrappers::identity::sid::Sid; use win_api_wrappers::process::Process; use win_api_wrappers::raw::Win32::Security::{WinBuiltinUsersSid, TOKEN_QUERY}; @@ -32,10 +30,9 @@ use win_api_wrappers::utils::CommandLine; use anyhow::{anyhow, bail, Result}; -use crate::desktop::launch_consent; +use crate::config; use crate::error::Error; use crate::utils::{ensure_protected_directory, file_hash, AccountExt, MultiHasher}; -use crate::{config, elevations}; use devolutions_pedm_shared::policy; pub(crate) struct IdList { @@ -96,10 +93,6 @@ impl IdList { self.data.values() } - pub(crate) fn iter_mut(&mut self) -> impl Iterator + '_ { - self.data.values_mut() - } - pub(crate) fn contains(&self, id: &Id) -> bool { self.data.contains_key(id) } @@ -148,7 +141,6 @@ pub(crate) struct Policy { config_path: PathBuf, config: Configuration, profiles: IdList, - rules: IdList, current_profiles: HashMap, } @@ -158,7 +150,6 @@ impl Policy { config_path: policy_config_path().into_std_path_buf(), config: Configuration::default(), profiles: IdList::new(policy_profiles_path().into_std_path_buf()), - rules: IdList::new(policy_rules_path().into_std_path_buf()), current_profiles: HashMap::new(), }; @@ -169,7 +160,6 @@ impl Policy { ensure_protected_directory(policy_path().as_std_path(), vec![])?; ensure_protected_directory(policy.profiles.path(), vec![])?; - ensure_protected_directory(policy.rules.path(), vec![])?; if !policy.config_path.exists() { let config = Configuration::default(); @@ -191,7 +181,6 @@ impl Policy { pub(crate) fn load(&mut self) -> Result<()> { self.load_config(); self.profiles.load()?; - self.rules.load()?; Ok(()) } @@ -288,39 +277,6 @@ impl Policy { Ok(()) } - pub(crate) fn replace_rule(&mut self, old_id: &Id, rule: Rule) -> Result<()> { - if !self.rules.contains(old_id) { - bail!(Error::NotFound); - } else if old_id != &rule.id && self.rules.contains(&rule.id) { - bail!(Error::InvalidParameter); - } - - let profile_ids = self - .profiles - .iter() - .filter(|p| p.rules.contains(old_id)) - .map(|p| p.id().clone()) - .collect::>(); - - self.remove_rule(old_id)?; - - let new_id = rule.id.clone(); - self.add_rule(rule)?; - - for profile_id in profile_ids { - let mut profile = self - .profile(&profile_id) - .cloned() - .ok_or_else(|| anyhow!(Error::NotFound))?; - - profile.rules.push(new_id.clone()); - - self.replace_profile(&profile_id, profile)?; - } - - Ok(()) - } - pub(crate) fn remove_profile(&mut self, id: &Id) -> Result<()> { self.profiles.remove(id)?; @@ -329,30 +285,6 @@ impl Policy { Ok(()) } - pub(crate) fn rule(&self, id: &Id) -> Option<&Rule> { - self.rules.get(id) - } - - pub(crate) fn rules(&self) -> impl Iterator + '_ { - self.rules.iter() - } - - pub(crate) fn add_rule(&mut self, rule: Rule) -> Result<()> { - self.rules.add(rule) - } - - pub(crate) fn remove_rule(&mut self, id: &Id) -> Result<()> { - self.rules.remove(id)?; - - for prof in self.profiles.iter_mut() { - if let Some(index) = prof.rules.iter().position(|x| x == id) { - prof.rules.remove(index); - } - } - - Ok(()) - } - pub(crate) fn assignments(&self) -> &HashMap> { &self.config.assignments } @@ -382,54 +314,16 @@ impl Policy { Ok(()) } - fn rule_for_request(&self, profile: &Profile, request: &ElevationRequest) -> Option<&Rule> { - for rule_id in &profile.rules { - match self.rules.get(rule_id) { - Some(rule) => { - if !rule.target.is_match(&request.target) - || rule.asker.as_ref().is_some_and(|x| !x.is_match(&request.asker)) - { - continue; - } - - return Some(rule); - } - None => { - warn!(%profile.id, %rule_id, "Profile assigned to non existent rule"); - } - }; - } - - None - } - pub(crate) fn validate(&self, session_id: u32, request: &ElevationRequest) -> Result<()> { let profile = self .user_current_profile(&request.asker.user) .ok_or_else(|| anyhow!(Error::AccessDenied))?; - let rule = self - .rule_for_request(profile, request) - .ok_or_else(|| anyhow!(Error::AccessDenied))?; - - let mut elevation_type = rule.elevation_kind; - if elevations::is_elevated(&request.asker.user) { - elevation_type = policy::ElevationKind::Confirm - } + let elevation_type = profile.default_elevation_kind; match elevation_type { policy::ElevationKind::AutoApprove => Ok(()), - policy::ElevationKind::Confirm => { - if !launch_consent( - session_id, - &Sid::try_from(request.asker.user.account_sid.as_str())?, - &request.target.path, - )? { - bail!(Error::Cancelled); - } - - Ok(()) - } + policy::ElevationKind::Confirm => bail!(Error::InvalidParameter), policy::ElevationKind::ReasonApproval => bail!(Error::InvalidParameter), policy::ElevationKind::Deny => bail!(Error::AccessDenied), } @@ -454,12 +348,6 @@ fn policy_profiles_path() -> Utf8PathBuf { dir } -fn policy_rules_path() -> Utf8PathBuf { - let mut dir = policy_path(); - dir.push("rules"); - dir -} - pub(crate) fn policy() -> &'static RwLock { static POLICY: OnceLock> = OnceLock::new(); diff --git a/crates/devolutions-pedm/src/utils.rs b/crates/devolutions-pedm/src/utils.rs index 179ec6e66..28f8d7b6a 100644 --- a/crates/devolutions-pedm/src/utils.rs +++ b/crates/devolutions-pedm/src/utils.rs @@ -98,47 +98,52 @@ pub(crate) fn file_hash(path: &Path) -> Result { Ok(hasher.finalize()) } -pub(crate) fn ensure_protected_directory(dir: &Path, readers: Vec) -> Result<()> { - let owner = Sid::from_well_known(WinLocalSystemSid, None)?; - - let mut aces = vec![Ace { - flags: OBJECT_INHERIT_ACE, - access_mask: GENERIC_ALL.0, - data: AceType::AccessAllowed(owner.clone()), - }]; - - aces.extend(readers.into_iter().map(|sid| Ace { - flags: OBJECT_INHERIT_ACE, - access_mask: GENERIC_READ.0, - data: AceType::AccessAllowed(sid), - })); - - let dacl = InheritableAcl { - kind: InheritableAclKind::Protected, - acl: Acl::with_aces(aces), - }; - - if dir.exists() { - set_named_security_info( - &dir.to_string_lossy(), - SE_FILE_OBJECT, - Some(&owner), - None, - Some(&dacl), - None, - )?; - } else { - create_directory( - dir, - &SecurityAttributes { - security_descriptor: Some(SecurityDescriptor { - owner: Some(owner), - dacl: Some(dacl), - ..Default::default() - }), - inherit_handle: false, - }, - )?; +pub(crate) fn ensure_protected_directory(dir: &Path, _readers: Vec) -> Result<()> { + // FIXME: Underlying behaviour of security primitives must be corrected before this can work + // let owner = Sid::from_well_known(WinLocalSystemSid, None)?; + + // let mut aces = vec![Ace { + // flags: OBJECT_INHERIT_ACE, + // access_mask: GENERIC_ALL.0, + // data: AceType::AccessAllowed(owner.clone()), + // }]; + + // aces.extend(readers.into_iter().map(|sid| Ace { + // flags: OBJECT_INHERIT_ACE, + // access_mask: GENERIC_READ.0, + // data: AceType::AccessAllowed(sid), + // })); + + // let dacl = InheritableAcl { + // kind: InheritableAclKind::Protected, + // acl: Acl::with_aces(aces), + // }; + + // if dir.exists() { + // set_named_security_info( + // &dir.to_string_lossy(), + // SE_FILE_OBJECT, + // Some(&owner), + // None, + // Some(&dacl), + // None, + // )?; + // } else { + // create_directory_with_security_attributes( + // dir, + // &SecurityAttributes { + // security_descriptor: Some(SecurityDescriptor { + // owner: Some(owner), + // dacl: Some(dacl), + // ..Default::default() + // }), + // inherit_handle: false, + // }, + // )?; + // } + + if !dir.exists() { + create_directory(dir)?; } Ok(()) diff --git a/crates/win-api-wrappers/src/identity/sid.rs b/crates/win-api-wrappers/src/identity/sid.rs index cea10de7b..73672219d 100644 --- a/crates/win-api-wrappers/src/identity/sid.rs +++ b/crates/win-api-wrappers/src/identity/sid.rs @@ -244,17 +244,24 @@ impl TryFrom<&Sid> for RawSid { .size() ]; - #[allow(clippy::cast_ptr_alignment)] // FIXME(DGW-221): Raw* hack is flawed. - // SAFETY: Buffer is valid and can fit `SID` and all sub authorites. - let sid = unsafe { &mut *buf.as_mut_ptr().cast::() }; + let sid = buf.as_mut_ptr().cast::(); - sid.IdentifierAuthority = value.identifier_identity; - sid.Revision = value.revision; - sid.SubAuthorityCount = value.sub_authority.len().try_into()?; + // SAFETY: Aligment is valid for these `write`s. + unsafe { + ptr::addr_of_mut!((*sid).IdentifierAuthority).write(value.identifier_identity); + ptr::addr_of_mut!((*sid).Revision).write(value.revision); + ptr::addr_of_mut!((*sid).SubAuthorityCount).write(value.sub_authority.len().try_into()?); + } for (i, v) in value.sub_authority.iter().enumerate() { // SAFETY: `SubAuthority` is a VLA and we have previously correctly sized it. - unsafe { *sid.SubAuthority.get_unchecked_mut(i) = *v }; + // We need to use `write_unaligned`, because we are effectively writing into a [u8] buffer + // using a pointer with alignment 1, while aligment 4 is required when writing u32 values. + unsafe { + (ptr::addr_of_mut!((*sid).SubAuthority) as *mut u32) + .offset(i as isize) + .write_unaligned(*v) + }; } Ok(Self { buf }) diff --git a/crates/win-api-wrappers/src/security/privilege.rs b/crates/win-api-wrappers/src/security/privilege.rs index 897af64d4..4fb6325ce 100644 --- a/crates/win-api-wrappers/src/security/privilege.rs +++ b/crates/win-api-wrappers/src/security/privilege.rs @@ -58,15 +58,22 @@ impl TryFrom<&TokenPrivileges> for RawTokenPrivileges { .size() ]; - // SAFETY: `buf` is at least as big as `TOKEN_PRIVILEGES` and its privileges. - #[allow(clippy::cast_ptr_alignment)] // FIXME(DGW-221): Raw* hack is flawed. - let privileges = unsafe { &mut *buf.as_mut_ptr().cast::() }; + let privileges = buf.as_mut_ptr().cast::(); - privileges.PrivilegeCount = value.0.len().try_into()?; + // SAFETY: Aligment is valid for these `write`s. + unsafe { + std::ptr::addr_of_mut!((*privileges).PrivilegeCount).write(value.0.len().try_into()?); + } for (i, v) in value.0.iter().enumerate() { // SAFETY: `Privileges` is a VLA and we have previously correctly sized it. - unsafe { *privileges.Privileges.get_unchecked_mut(i) = *v }; + // We need to use `write_unaligned`, because we are effectively writing into a [u8] buffer + // using a pointer with alignment 1, while aligment 8 is required when writing isize values on a 64-bit system. + unsafe { + (std::ptr::addr_of_mut!((*privileges).Privileges) as *mut LUID_AND_ATTRIBUTES) + .offset(i as isize) + .write_unaligned(*v) + }; } Ok(Self(buf)) diff --git a/crates/win-api-wrappers/src/token.rs b/crates/win-api-wrappers/src/token.rs index 02446d101..7b6f39b31 100644 --- a/crates/win-api-wrappers/src/token.rs +++ b/crates/win-api-wrappers/src/token.rs @@ -570,15 +570,22 @@ impl TryFrom<&TokenGroups> for RawTokenGroups { .size() ]; - // SAFETY: `buf` is at least as big as `TOKEN_GROUPS` and its groups. - #[allow(clippy::cast_ptr_alignment)] // FIXME(DGW-221): Raw* hack is flawed. - let groups = unsafe { &mut *buf.as_mut_ptr().cast::() }; + let groups = buf.as_mut_ptr().cast::(); - groups.GroupCount = value.0.len().try_into()?; + // SAFETY: Aligment is valid for these `write`s. + unsafe { + ptr::addr_of_mut!((*groups).GroupCount).write(value.0.len().try_into()?); + } for (i, v) in raw_sid_and_attributes.iter().enumerate() { // SAFETY: `Groups` is a VLA and we have previously correctly sized it. - unsafe { *groups.Groups.get_unchecked_mut(i) = *v.as_raw() }; + // We need to use `write_unaligned`, because we are effectively writing into a [u8] buffer + // using a pointer with alignment 1, while aligment 8 is required when writing isize values on a 64-bit system. + unsafe { + (ptr::addr_of_mut!((*groups).Groups) as *mut SID_AND_ATTRIBUTES) + .offset(i as isize) + .write_unaligned(*v.as_raw()) + }; } Ok(Self { diff --git a/crates/win-api-wrappers/src/utils.rs b/crates/win-api-wrappers/src/utils.rs index 45df4562e..2f190a930 100644 --- a/crates/win-api-wrappers/src/utils.rs +++ b/crates/win-api-wrappers/src/utils.rs @@ -587,7 +587,16 @@ impl Link { } } -pub fn create_directory(path: &Path, security_attributes: &SecurityAttributes) -> Result<()> { +pub fn create_directory(path: &Path) -> Result<(), Error> { + let path = WideString::from(path); + + // SAFETY: `path` is NUL terminated. + unsafe { CreateDirectoryW(path.as_pcwstr(), None) }?; + + Ok(()) +} + +pub fn create_directory_with_security_attributes(path: &Path, security_attributes: &SecurityAttributes) -> Result<()> { let path = WideString::from(path); let security_attributes = RawSecurityAttributes::try_from(security_attributes)?; diff --git a/dotnet/DesktopAgent/App.config b/dotnet/DesktopAgent/App.config new file mode 100644 index 000000000..193aecc67 --- /dev/null +++ b/dotnet/DesktopAgent/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dotnet/DesktopAgent/DesktopAgent.csproj b/dotnet/DesktopAgent/DesktopAgent.csproj new file mode 100644 index 000000000..21e26f4b4 --- /dev/null +++ b/dotnet/DesktopAgent/DesktopAgent.csproj @@ -0,0 +1,97 @@ + + + + + Debug + AnyCPU + {6DFAA3D7-4F38-4329-8CEE-D6968959A701} + WinExe + Devolutions.Agent.Desktop + DevolutionsDesktopAgent + v4.8 + latest + 512 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + Resources\AppIcon.ico + + + + + + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + 7.1.3 + + + + + + + + {2d633ac7-9fdc-4cda-bbb8-7fd33493d79f} + Devolutions.Pedm.Client + + + + \ No newline at end of file diff --git a/dotnet/DesktopAgent/DesktopAgent.sln b/dotnet/DesktopAgent/DesktopAgent.sln new file mode 100644 index 000000000..ec56eb82a --- /dev/null +++ b/dotnet/DesktopAgent/DesktopAgent.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35201.131 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DesktopAgent", "DesktopAgent.csproj", "{6DFAA3D7-4F38-4329-8CEE-D6968959A701}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Devolutions.Pedm.Client", "..\..\crates\devolutions-pedm\openapi\dotnet-client\src\Devolutions.Pedm.Client\Devolutions.Pedm.Client.csproj", "{2D633AC7-9FDC-4CDA-BBB8-7FD33493D79F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6DFAA3D7-4F38-4329-8CEE-D6968959A701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6DFAA3D7-4F38-4329-8CEE-D6968959A701}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6DFAA3D7-4F38-4329-8CEE-D6968959A701}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6DFAA3D7-4F38-4329-8CEE-D6968959A701}.Release|Any CPU.Build.0 = Release|Any CPU + {2D633AC7-9FDC-4CDA-BBB8-7FD33493D79F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D633AC7-9FDC-4CDA-BBB8-7FD33493D79F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D633AC7-9FDC-4CDA-BBB8-7FD33493D79F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D633AC7-9FDC-4CDA-BBB8-7FD33493D79F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DBB249B6-FFF5-473E-9E8F-D3D59AA89245} + EndGlobalSection +EndGlobal diff --git a/dotnet/DesktopAgent/Program.cs b/dotnet/DesktopAgent/Program.cs new file mode 100644 index 000000000..0fa8789ed --- /dev/null +++ b/dotnet/DesktopAgent/Program.cs @@ -0,0 +1,269 @@ +using Devolutions.Agent.Desktop.Properties; + +using Microsoft.Toolkit.Uwp.Notifications; + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Channels; +using System.Runtime.Remoting.Channels.Ipc; +using System.Security.Principal; +using System.Threading; +using System.Windows.Forms; + +namespace Devolutions.Agent.Desktop +{ + internal static class Program + { + private const string MutexId = "Local\\BF3262DE-F439-455F-B67F-9D32D9FD5E58"; + + private static string[] Args { get; set; } + + internal static AppContext AppContext { get; private set; } + + internal static Logger Log = new(new FileLogger()); + + [STAThread] + private static void Main(string[] args) + { + Log.Debug("Starting..."); + + Args = args; + + using Mutex mutex = new(false, MutexId); + const string serviceUri = "RemotingServer"; + + if (!mutex.WaitOne(0)) + { + Log.Debug("Forwarding arguments to existing instance"); + + try + { + IpcChannel clientChannel = new(); + ChannelServices.RegisterChannel(clientChannel, false); + SingleInstance app = (SingleInstance)Activator.GetObject(typeof(SingleInstance), + $"ipc://{MutexId}/{serviceUri}"); + app.Execute(args); + } + catch (Exception e) + { + Log.Error(e.ToString()); + } + + return; + } + + Log.Debug("Starting IPC server"); + + try + { + IpcChannel serverChannel = new(MutexId); + ChannelServices.RegisterChannel(serverChannel, false); + RemotingConfiguration.RegisterWellKnownServiceType(typeof(SingleInstance), + serviceUri, WellKnownObjectMode.Singleton); + } + catch (Exception e) + { + Log.Error(e.ToString()); + } + + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Idle += Application_OnIdle; + + AppContext = new AppContext(); + + Application.Run(AppContext); + } + + private static void Application_OnIdle(object sender, EventArgs e) + { + Application.Idle -= Application_OnIdle; + + AppContext.Dispatch(Args); + } + } + + public class AppContext : ApplicationContext + { + private readonly SynchronizationContext synchronizationContext; + + private readonly NotifyIcon trayIcon; + + public AppContext() + { + string title = + $"{Assembly.GetExecutingAssembly().GetCustomAttribute().Title} {Assembly.GetExecutingAssembly().GetName().Version}"; + + this.synchronizationContext = new WindowsFormsSynchronizationContext(); + this.trayIcon = new NotifyIcon() + { + Icon = Resources.AppIcon, + ContextMenu = new ContextMenu(new [] + { + new MenuItem(title) { Enabled = false}, + new MenuItem("Exit", OnExit_Click), + }), + Visible = true, + }; + } + + internal void Dispatch(string[] args) + { + if (args?.Length < 3) + { + Program.Log.Debug("Args is null or has less than 3 elements"); + + return; + } + + string title; + string text; + + try + { + Program.Log.Debug($"Arguments: {string.Join(", ", args)}"); + + SecurityIdentifier sid = new SecurityIdentifier(args[1]); + string verb = args[2]; + IEnumerable commandArgs = args.Skip(3); + + Program.Log.Debug($"Parsed arguments: {sid.Value} {verb} {string.Join(", ", commandArgs)}"); + + switch (verb) + { + case "error": + { + // TODO: Better error handling than just HRESULT conversion + title = "Unexpected Error"; + text = new Win32Exception(int.Parse(commandArgs.First())).Message; + break; + } + + default: + { + Program.Log.Error($"Unhandled command verb: {verb}"); + + return; + } + } + } + catch (Exception e) + { + Program.Log.Error($"Failed to parse arguments: {e}"); + + return; + } + + this.synchronizationContext.Post(_ => + { + new ToastContentBuilder() + .AddText(title, hintMaxLines: 1) + .AddText(text) + .Show(); + }, null); + } + + protected override void Dispose(bool disposing) + { + Program.Log.Dispose(); + + this.trayIcon?.Dispose(); + + base.Dispose(disposing); + } + + private void OnExit_Click(object sender, EventArgs e) + { + trayIcon.Visible = false; + + Application.Exit(); + } + } + + public class SingleInstance : MarshalByRefObject + { + public void Execute(string[] args) + { + Program.AppContext.Dispatch(args); + } + } + + internal interface ILogger + { + void Log(string message, string level); + } + + internal class Logger : IDisposable + { + private readonly ILogger logger; + + public Logger(ILogger logger) + { + this.logger = logger; + } + + public void Debug(string message) + { + this.logger.Log(message, "DEBUG"); + } + + public void Info(string message) + { + this.logger.Log(message, "INFO"); + } + + public void Error(string message) + { + this.logger.Log(message, "ERROR"); + } + + public void Dispose() + { + if (this.logger is IDisposable disposable) + { + disposable.Dispose(); + } + } + } + + internal sealed class FileLogger : ILogger, IDisposable + { + private readonly FileStream fs; + + private readonly TextWriter writer; + + public FileLogger() + { + string tempPath = Path.GetTempPath(); + string path = Path.Combine(tempPath, $"DevolutionsDesktopAgent_{Guid.NewGuid()}.log"); + + try + { + this.fs = new FileStream(path, FileMode.CreateNew); + this.writer = new StreamWriter(this.fs); + } + catch + { + // ignored + } + } + + public void Log(string message, string level) + { + this.writer?.WriteLine($"{DateTime.Now:O} [{level}] {message}"); + this.writer?.Flush(); + } + + public void Dispose() + { + writer?.Dispose(); + fs?.Dispose(); + } + } +} diff --git a/dotnet/DesktopAgent/Properties/AssemblyInfo.cs b/dotnet/DesktopAgent/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..c33a3b92c --- /dev/null +++ b/dotnet/DesktopAgent/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Devolutions Agent")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Devolutions Agent")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6dfaa3d7-4f38-4329-8cee-d6968959a701")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/dotnet/DesktopAgent/Properties/Resources.Designer.cs b/dotnet/DesktopAgent/Properties/Resources.Designer.cs new file mode 100644 index 000000000..ec84e76c1 --- /dev/null +++ b/dotnet/DesktopAgent/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Devolutions.Agent.Desktop.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Devolutions.Agent.Desktop.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon AppIcon { + get { + object obj = ResourceManager.GetObject("AppIcon", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + } +} diff --git a/dotnet/DesktopAgent/Properties/Resources.resx b/dotnet/DesktopAgent/Properties/Resources.resx new file mode 100644 index 000000000..a07f79675 --- /dev/null +++ b/dotnet/DesktopAgent/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\AppIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/dotnet/DesktopAgent/Properties/Settings.Designer.cs b/dotnet/DesktopAgent/Properties/Settings.Designer.cs new file mode 100644 index 000000000..31e6358a9 --- /dev/null +++ b/dotnet/DesktopAgent/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Devolutions.Agent.Desktop.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/dotnet/DesktopAgent/Properties/Settings.settings b/dotnet/DesktopAgent/Properties/Settings.settings new file mode 100644 index 000000000..39645652a --- /dev/null +++ b/dotnet/DesktopAgent/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dotnet/DesktopAgent/Resources/AppIcon.ico b/dotnet/DesktopAgent/Resources/AppIcon.ico new file mode 100644 index 000000000..cef53ed17 Binary files /dev/null and b/dotnet/DesktopAgent/Resources/AppIcon.ico differ